colors2d | R Documentation |
This function returns a color value for each row of the 2-column dataset supplied, based on a 2D color palette interpolated from 4 corner colors.
colors2d(
data,
colors = c("yellow", "green", "blue", "magenta"),
xtrans = c("none", "log", "rank"),
ytrans = c("none", "log", "rank")
)
data |
Matrix or data frame with 2 numeric columns; they will map to x and y. |
colors |
Vector of 4 corner colors to interpolate, clockwise from upper right. |
xtrans, ytrans |
Transformation to apply to x and y variables before applying a linear color mapping: either "none" (default), "log", or "rank". |
Character vector of colors.
plot(iris,
col = colors2d(iris[, c("Sepal.Length", "Sepal.Width")]),
pch = 19, cex = 2)
plot(iris,
col = colors2d(iris[, c("Sepal.Length", "Sepal.Width")],
colors = c("limegreen", "gold", "black", "dodgerblue"),
xtrans = "rank", ytrans = "rank"),
pch = 19, cex = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.