set.seed(22231)
# A random figure
dat <- matrix(runif(100*3), ncol = 3)
col <- colorRamp2(c("blue", "white", "red"))
plot(
dat[,1], dat[,2],
col = rgb(col(dat[,3]), maxColorValue=255),
cex=2, pch=20
)
# Pretty color key
colorkey(
x0 = .60, y0 = .80,
x1 = .95, y1 = .95,
cols = c("blue", "white", "red"),
main = "Some color scale"
)
Run the code above in your browser using DataLab