denstrip.legend {denstrip} | R Documentation |
Add a legend to a density strip or shaded region
Description
Add a legend to an existing plot with a density strip or shaded region, indicating the mapping of colours to densities.
Usage
denstrip.legend(x, y, width, len, colmax, colmin="white", gamma=1,
horiz=FALSE, max=1, nticks = 5, ticks, value.adj = 0,
cex, main = "Density", lattice=FALSE)
panel.denstrip.legend(...)
Arguments
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 |
colmin |
Colour to shade the minimum density, likewise.
Defaults to "white". If this is set to |
gamma |
Gamma correction to apply to the colour palette, see |
horiz |
Legend strip drawn vertically ( |
max |
Maximum density on the legend, which is represented by
|
nticks |
Number of tick marks on the axis adjacent to the
legend, if |
ticks |
Positions of numbered ticks on the axis adjacent to the
legend. Defaults to |
value.adj |
Extra adjustment for the axis labels to the right
(if |
cex |
Text expansion. Defaults to |
main |
Text to place above the legend. |
lattice |
Set this to |
... |
Other arguments passed to |
Author(s)
Christopher Jackson <chris.jackson@mrc-bsu.cam.ac.uk>
See Also
Examples
if (requireNamespace("survival", quietly=TRUE)){
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)
### TODO if max not supplied - ticks are not meaningful.
### In help example, find actual max dens used for densregion
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)
}