Learn R Programming

berryFunctions (version 1.4)

colPointsLegend: legend for colPoints

Description

Adds legends to plots created or enhanced with colPoints

Usage

colPointsLegend(xpos=0.5, ypos=1, length=0.5, width=0.05, z,
Range=range(z, finite=TRUE), numcol=100, alpha=1,
col=rev(rainbow(numcol, start=0, end=0.7, alpha=alpha)),
at=Pretty, atminmax=FALSE, labels=at, xpd=TRUE, lines=TRUE, horizontal=TRUE,
labelpos=1, white=NA, ...)

Arguments

xpos
Position of left end of the legend-color-bar; Relative to plot region, between 0 and 1. DEFAULT: 0.5 (middle of plot)
ypos
Upper position. If(xpd), you could use 1.1 to set legend into the margin. DEFAULT: 1 (top)
length
Length of legend bar, relative between 0 and 1. DEFAULT: 0.5 (half the plot)
width
Width of legend, also relative. DEFAULT: 0.05
z
Values used for the default of Range. Matrix oder Vektor
Range
2 values for the ends of the color spectrum. DEFAULT: range(z)
numcol
Number of color nuances in the default color palette. DEFAULT: 100
alpha
Transparency for default palette. 0 is transp, 0.5 semitransp. DEFAULT: 1 (intransparent)
col
Colors to be used. DEFAULT: from blue to red
at
values at which labels are positioned. DEFAULT: Pretty, calculated inside the function, an altered result from pretty.
atminmax
Logical. Should the extreme ends of Range be labeled additionally? DEFAULT: FALSE
labels
The labels that are written at the position of "at". DEFAULT: at
xpd
Should the legend expand outside of the plot region into the margins? DEFAULT: TRUE
lines
Logical. Should black lines over the color bar mark the exact position of "at"? DEFAULT: TRUE
horizontal
Logical. Should the legend be drawn horizontally? If FALSE, a vertical legend is drawn, with length and width exchanged. DEFAULT: TRUE
labelpos
Position of labels relative to the bar. Possible: 1 (below), 2 (left), 3 (above), 4 (right), 5(on top of bar). DEFAULT: 1
white
Coordinates for white polygon drawn underneath legend, making labels readable. DEFAULT: NA
...
Further arguments passed to text, e.g. cex, font, col. But NOT adj!

Value

  • none, adds legend bar to current plot

See Also

colPoints for examples!

Examples

Run this code
# See colpoints

Run the code above in your browser using DataLab