denstrip.legend {denstrip} | R Documentation |
Add a legend to an existing plot with a density strip or shaded region, indicating the mapping of colours to densities.
denstrip.legend(x, y, width, len, colmax, gamma=1, horiz=FALSE, max, nticks = 5, ticks, value.adj = 0, cex, main = "Density", lattice=FALSE) panel.denstrip.legend(...)
x |
Central x position of the legend. |
y |
Central y position of the legend. |
width |
Width of the legend strip, that is, the length of its shorter dimension. Defaults to 1/30 of the axis range. |
len |
Length of the legend strip, that is, the length of its longer dimension. Defaults to 1/4 of the axis range. |
colmax |
Colour at the maximum density, either as a built-in R
colour name (one of colors() ) or an RGB hex value. Defaults
to par("fg") or its lattice equivalent, which is
"black" by default. |
gamma |
Gamma correction to apply to the colour palette, see denstrip . |
horiz |
Legend strip drawn vertically (FALSE ) or
horizontally (TRUE ). |
max |
Maximum density on the legend, which is represented by colmax . |
nticks |
Number of tick marks on the axis adjacent to the
legend, if ticks not supplied. |
ticks |
Positions of numbered ticks on the axis adjacent to the
legend. Defaults to nticks equally spaced ticks between 0 and
the maximum density. |
value.adj |
Extra adjustment for the axis labels to the right
(if horiz=FALSE ) or downwards (if horiz=TRUE ). |
cex |
Text expansion. Defaults to par("cex") * 0.75 or
trellis.par.get("axis.text")$cex * 0.75 . |
main |
Text to place above the legend. |
lattice |
Set this to TRUE to make denstrip.legend
a lattice panel function instead of a base graphics function. panel.denstrip.legend(x,...) is equivalent to
denstrip.legend(x, lattice=TRUE, ...) . |
... |
Other arguments passed to panel.denstrip.legend . |
Christopher Jackson <chris.jackson@mrc-bsu.cam.ac.uk>
library(survival) fit <- survfit(Surv(time, status) ~ 1, data=aml, conf.type="log-log") plot(fit, col=0) densregion(fit) denstrip.legend(100, 0.8) denstrip.legend(120, 0.8, width=3, len=0.4, value.adj=5) denstrip.legend(40, 0.9, horiz=TRUE) denstrip.legend(60, 0.7, horiz=TRUE, width=0.02, len=50, value.adj=0.04)