Learn R Programming

PBSmodelling (version 2.67.266)

addLegend: Add a Legend to a Plot Using Relative (0:1) Coordinates

Description

Place a legend in a plot using relative (0:1) coordinates.

Usage

addLegend(x, y, ...)

Arguments

x
x-axis coordinate in the range (0:1); can step outside.
y
y-axis coordinate in the range (0:1); can step outside.
...
arguments used by the function legend, such as lines, text, or rectangle.

See Also

addArrows, addLabel

Examples

Run this code
local(envir=.PBSmodEnv,expr={
  oldpar = par(no.readonly=TRUE)
  resetGraph()
  n <- sample(1:length(colors()),15); clrs <- colors()[n]
  addLegend(.2,1,fill=clrs,leg=clrs,cex=1.5)
  par(oldpar)
})

Run the code above in your browser using DataLab