Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rlegend

Special Version of legend for R


Description

rlegend is a version of legend for R that implements plot=FALSE, adds grid=TRUE, and defaults lty, lwd, pch to NULL and checks for length>0 rather than missing(), so it's easier to deal with non-applicable parameters. But when grid is in effect, the preferred function to use is rlegendg, which calls the lattice draw.key function.

Usage

rlegend(x, y, legend, fill, col = "black", lty = NULL, lwd = NULL,
        pch = NULL, angle = NULL, density = NULL, bty = "o",
        bg = par("bg"), pt.bg = NA, cex = 1, xjust = 0, yjust = 1,
        x.intersp = 1, y.intersp = 1, adj = 0, text.width = NULL,
        merge = do.lines && has.pch, trace = FALSE, ncol = 1,
        horiz = FALSE, plot = TRUE, grid = FALSE, ...)

rlegendg(x, y, legend, col=pr$col[1], lty=NULL,
         lwd=NULL, pch=NULL, cex=pr$cex[1], other=NULL)

Arguments

x,y,legend,fill,col,lty,lwd,pch,angle,density,bty,bg,pt.bg,cex,xjust, yjust,x.intersp,y.intersp,adj,text.width,merge,trace,ncol,horiz

see legend

plot

set to FALSE to suppress drawing the legend. This is used the compute the size needed for when the legend is drawn with a later call to rlegend.

grid

set to TRUE if the grid package is in effect

...

see legend

other

a list containing other arguments to pass to draw.key. See the help file for xyplot.

Value

a list with elements rect and text. rect has elements w, h, left, top with size/position information.

Author(s)

Frank Harrell and R-Core

See Also


Hmisc

Harrell Miscellaneous

v4.5-0
GPL (>= 2)
Authors
Frank E Harrell Jr <fh@fharrell.com>, with contributions from Charles Dupont and many others.
Initial release
2021-02-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.