I am interested in having a \"good\" divergent color pallette. One could obviously use just red, white, and blue:
img <- function(obj, nam) {
image(1:le
The scico package (Palettes for R based on the Scientific Colour-Maps ) has several good diverging palettes that are perceptually uniform and colorblind safe (e.g., vik, roma, berlin).
Also available for Python, MatLab, GMT, QGIS, Plotly, Paraview, VisIt, Mathematica, Surfer, d3, etc. here
Paper: Crameri, F. (2018), Geodynamic diagnostics, scientific visualisation and StagLab 3.0, Geosci. Model Dev., 11, 2541-2562, doi:10.5194/gmd-11-2541-2018
Blog: The Rainbow Colour Map (repeatedly) considered harmful
# install.packages('scico')
# or
# install.packages("devtools")
# devtools::install_github("thomasp85/scico")
library(scico)
scico_palette_show(palettes = c("broc", "cork", "vik",
"lisbon", "tofino", "berlin",
"batlow", "roma"))
Another great package is cmocean. Its colormaps are available in R via the pals package or the oce package.
Paper: Thyng, K. M., Greene, C. A., Hetland, R. D., Zimmerle, H. M., & DiMarco, S. F. (2016). True colors of oceanography. Oceanography, 29(3), 10, http://dx.doi.org/10.5670/oceanog.2016.66.
Talk: PLOTCON 2016: Kristen Thyng, Custom Colormaps for Your Field.
### install.packages("devtools")
### devtools::install_github("kwstat/pals")
library(pals)
pal.bands(ocean.balance, ocean.delta, ocean.curl, main = "cmocean")
Edit: add seven levels max colorblind-friendly palettes from the rcartocolor package
library(rcartocolor)
display_carto_all(type = 'diverging', colorblind_friendly = TRUE)