number.to.colors | R Documentation |
Automatically convert a vector of numbers into a color for easy plotting
number.to.colors(value, colors = c("red", "blue"), num = 100)
value |
a vector of numbers. |
colors |
a vector of two or more colors representing the inflection points of the gradients, passed to |
num |
The number of unique intervals for colors. Chose larger numbers for finer gradients (higher resolution). |
a vector of colors.
Dustin Fife
string.to.colors
colorRampPalette
gradient.legend
#### plot three variables, represent the third with a color d = mvrnorm(100, mu=c(0,0,0), Sigma=matrix(c(1, .6, .6, .6, 1, .6, .6, .6, 1), ncol=3)) plot(d[,1:2], col=number.to.colors(d[,3], c("black", "pink")), pch=16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.