if (FALSE) {
library(RColorBrewer)
display.brewer.all(n = 11, type = "div")
title(main = "Divergent color palette")
display.brewer.all(n = 9, type = c("seq"))
title(main = "Sequential color palette")
img <- function(obj, nam) {
image(1:length(obj), 1, as.matrix(1:length(obj)),
col = obj,
main = nam, ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)
}
par(mfrow = c(10, 1))
img(rev(cool_warm(500)), "cool_warm, (Moreland 2009)")
img(RdBu(500), "RdBu")
img(BrBG(500), "BrBG")
img(PiYG(500), "PiYG")
img(PRGn(500), "PRGn")
img(PuOr(500), "PuOr")
img(RdGy(500), "RdGy")
img(RdYlBu(500), "RdYlBu")
img(RdYlGn(500), "RdYlGn")
img(Spectral(500), "Spectral")
library(heatmaply)
heatmaply(cor(mtcars), colors = PiYG, limits = c(-1, 1))
heatmaply(cor(mtcars), colors = RdBu, limits = c(-1, 1))
}
Run the code above in your browser using DataLab