Learn R Programming

zipfR (version 0.6-5)

zipfR.legend: Draw a Legend Box in one of the Corners (zipfR)

Description

zipfR.legend is a thin wrapper around the standard legend function, helping to place the legend box in one of the corners of the screen without knowing the precise coordinate ranges in use.

Fine control over the placement of the legend box is possible with the optional arguments margin.x and margin.y. zipfR.legend is used internally by the high-level plotting functions plot.spc and plot.vgc.

Usage

zipfR.legend(corner, margin.x=.05, margin.y=margin.x,
               legend=NULL, bg="white", ...)

Arguments

corner
an integer specifying the corner in which to place the legend box (1 = top left, 2 = top right, 3 = bottom right, and 4 = bottom left)
margin.x
distance of the legend box from the border of the plotting region along the x-axis, as a fraction of the width of the plotting region (default: 5%)
margin.y
distance of the legend box from the border of the plotting region along the y-axis, as a fraction of the height of the plotting region. Defaults to the same value as margin.x, so in most cases it is sufficient to specify ma
legend
a character or expression vector specifying the legend text (passed on to legend
bg
background colour of the legend box. Defaults to "white", so parts of the plot behind the box are hidden.
...
further arguments are passed on to the legend function and can be used to specify line styles, plot symbols and/or fill styles for the legend entries

See Also

legend for details on how to specify legend entries. Most of the options documented there can also be used with zipfR.legend. plot.spc, plot.vgc and zipfR.plotutils for more information about graphics functions in zipfR

Examples

Run this code
## zipfR.legend() can be used with all standard plots as well

plot(sin, 0, 2*pi)
zipfR.legend(2, margin.x=.1, legend="Some silly legend")

Run the code above in your browser using DataLab