legendmt: legend with multiline title

View source: R/legendmt.R

legendmtR Documentation

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

Author(s)

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

See Also

legend

Examples

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


berryFunctions documentation built on April 12, 2023, 12:36 p.m.