Description Usage Arguments Value Author(s) Examples
Associates numeric values with a set of colors.
1 2 | colorQuant(x, breaks, colors, lower = TRUE, warn = TRUE,
NAcolor = "transparent")
|
x |
Numeric vector. |
breaks |
Break points for the colors. In the absence of more suitable
information, quantiles of |
colors |
Vector of colors corresponding to |
lower |
If |
warn |
Warn if |
NAcolor |
Color assigned to |
A vector of colors of the same length as x
.
David Kneis david.kneis@tu-dresden.de
1 2 3 4 5 6 7 8 9 10 11 | x= runif(10)
x[3]= NA
x[5]= 2
breaks= c(0, .33, 0.66, 1)
colors= colorRampPalette(c("steelblue2","khaki2","brown"))(length(breaks))
low=FALSE
barplot(height=x, names.arg=1:length(x), ylim=c(0,1.2),
col=colorQuant(x, breaks, colors, low))
abline(h=breaks, lty=3)
legend("top", bty="n", horiz=TRUE, fill=colorQuant(breaks, breaks, colors, low),
legend=paste(ifelse(low, ">", "<"),breaks))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.