Learn R Programming

berryFunctions (version 1.21.2)

legendmt: legend with multiline title

Description

Draw a legend with title spanning several lines (i.e. with line breaks). Note that this is in development and not all inputs are correctly vectorized yet.

Usage

legendmt(
  x,
  y = NULL,
  legend,
  title,
  x.intersp = 1,
  fill = NA,
  col = par("col"),
  border = NA,
  lty = NA,
  lwd = NA,
  pch = NA,
  ...
)

Arguments

x, y, legend

Arguments as in legend

title

Character with linebreaks or vector of charstrings.

x.intersp, fill, col, border, lty, lwd, pch

Arguments as in legend

Further arguments passed to legend. If vectorized, please remember to prepend NAs or whatever.

Value

legend output

See Also

legend

Examples

Run this code
# NOT RUN {
plot(1:10)
  legend("topleft", letters[1:4], col=1:4, pch=1, title="very long title to be split up")
legendmt("topleft", letters[1:4], col=1:4, pch=1, title="very long title\nnow splat up")

# Alternative:
plot(1:10)
legend("topleft", "very long title to be split up")
legend("topleft", letters[1:4], col=1:4, pch=1, inset=c(0,0.09) )

# }

Run the code above in your browser using DataLab