Description Usage Arguments Examples
Adds a bar that associates numeric values with colors. Useful for ay plot that uses a linear color gradient to indicate a numeric value, and for which there are too many colors/ values to specify each individually.
1 2 |
x, y |
the locations of the center of the legend, as a proportion of plot area (between 0 and 1) |
w, h |
the width and height of the legend, as a proportion of plot area |
zlim |
lower and upper limit of values indicated by colors |
cols |
colors used in the original plot; e.g., created by |
horiz |
Logical, if FALSE (default), the colors in the legend change long the vertical axis |
axSide |
the side of the color bar on which the axis (line, ticks, labels) should be placed; if missing, reasonable default is chosen |
adj |
length 1 or 2 numeric vector to be passed to |
offset |
length 1 numeric vector to be passed to |
lab.cex |
numeric value to be passed to |
lab.sig |
integer, the number of significant digits to which the axis labels should be rounded; see |
1 2 3 4 5 6 7 8 9 10 | data(volcano)
v <- volcano
v[v<=quantile(v,0.2)] <- NA # small values to NA (will plot white)
v_cols <- zCol(256, 1:256)
image(v, col=v_cols)
zl <- range(v, na.rm=TRUE)
mapLegend(x=0.9, y=0.85, zlim=zl, cols=v_cols)
mapLegend(x=0.975, y=0.075, zlim=zl, cols=v_cols, w=0.025, h=0.125)
mapLegend(x=0.73, y=0.975, zlim=zl, cols=v_cols, w=0.125, h=0.025, horiz=TRUE)
mapLegend(x=0.93, y=0.25, zlim=zl, cols=v_cols, w=0.1, h=0.025, horiz=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.