autopal | R Documentation |
Return a palette vector from one of the built-in sets
autopal(set = "", n = 30, limits = NA, bias = 1, legend_len = 6)
set |
Colour set to use – see ?autocol for full list. A default |
n |
Length of colour vector to return, must be at least 2 |
limits |
Colour scale limits to pass to legend eg |
bias |
Skew to apply to colour-ramp (>1 increases resolution at low end, <1 at the high end) |
legend_len |
Continuous legend target size |
This can be used where a palette is provided rather than a mapped colour
vector, for example image()
. The limits must be specified for autolegend()
information to be updated.
Custom colour limits can be set using breaks
or levels
(see examples) if
the same colour range is needed across several plots.
See ?autocol for list of all available colour sets.
A character vector of colours of length n
giving a continuous colour palette sampled from set
.
If limits
are specified, information for a colour legend is produced of approximate length
legend_len
. This is stored in options('autolegend')
and not returned explicitly.
image(volcano, col=autopal('RdYlGn', n=100, limits=c(50,200), bias=1.5), breaks=seq(50,200,length.out=101) ) autolegend('bottom', inset=1, ncol=5) # Or using the slightly smarter filled.contour filled.contour(volcano, col=autopal('RdYlGn', n=20, limits=c(100,150)), levels=seq(50,200,length.out=21) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.