Learn R Programming

berryFunctions (version 1.22.5)

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,
  ...
)

Value

legend output

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.

Author

Berry Boessenkool, berry-b@gmx.de, Apr 2017

See Also

Examples

Run this code
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