col | R Documentation |
col.base
is the base for all other functions and allows full
flexibility in defining arbitrary quantitative color schemes.
col.bbr
provides blue-black-red diverging color scheme
(suitable for text and borderless glyphs on white background).
col.bwr
provides blue-white-red diverging color scheme
(suitable for maps and gryphs with borders).
col.br
provides blue-red color scheme.
col.bw
provides black-white color scheme.
col.q
returns transformed quantity between 0 and 1 for each
datapoint (suitable for pass-though to other color
schemes). gray(col.q(...))
has the same effect (except for
lack of alpha support) as col.bw
.
col.base(x, alpha=1, lim=c(0, 1), center = mean(lim), fit=FALSE, trans="id", na.col=NA, FN) col.bbr (x, alpha=1, lim=c(0, 1), center = mean(lim), fit=FALSE, trans="id", na.col=NA) col.bwr (x, alpha=1, lim=c(0, 1), center = mean(lim), fit=FALSE, trans="id", na.col=NA) col.br (x, alpha=1, lim=c(0, 1), center = mean(lim), fit=FALSE, trans="id", na.col=NA) col.bw (x, alpha=1, lim=c(0, 1), center = mean(lim), fit=FALSE, trans="id", na.col=NA) col.q (x, alpha=1, lim=c(0, 1), center = mean(lim), fit=FALSE, trans="id", na.col=NA)
x |
data values (treated as numeric vector). |
alpha |
alpha value. It will be passed directly to the call to
|
lim |
data cut-off limits (range). Values outside this range will be clipped to the nearest value in the range. |
center |
center of the scale (mostly useful to calibrate center color of diverging scales). |
fit |
if set to |
trans |
transformation of the resulting values. It can be
either a function or one of the character strings |
na.col |
color (or value when used in |
FN |
function accepting three arguments |
col.base
returns the result of the FN
function.
col.q
returns a vector of numeric values, all other functions
return a vector of colors as created by the rgb
function.
plot(0:10, rep(0, 11), ylim=c(0,5), cex=3, pch=19, col=col.bbr(0:10, fit=TRUE)) points(0:10, rep(1,11), cex=3, pch=21, bg=col.br(0:10, fit=TRUE), col=1) points(0:10, rep(2,11), cex=3, pch=21, bg=col.bw(0:10, fit=TRUE), col=1) points(0:10, rep(3,11), cex=3, pch=21, bg=col.bwr(0:10, fit=TRUE, trans=sqrt), col=1) points(0:10, rep(4,11), cex=3, pch=21, bg=col.bwr(0:10, fit=TRUE), col=1) points(0:10, rep(5,11), cex=3, pch=21, bg=col.bwr(0:10, fit=TRUE, trans=function(x) x^2), col=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.