paletteer

A comprehensive collection of color palettes in R

Anne Sophie Gill https://www.skemagloballab.io/gillAnneSophie.html (SKEMA Global Lab in AI)https://skemagloballab.io , Thierry Warin https://www.nuance-r.com/principalInvestigator.html (SKEMA Business School (Raleigh, NC))https://www.skemagloballab.io
03-12-2020

Learn how to customize the color of your visuals within the SKEMA Quantum Studio (Warin 2019), with the help of the paletteer package.

Palettes

Palettes are divided into 2 groups; discrete and continuous.

For discrete palette you have the choice between the fixed width palettes and dynamic palettes.

Fixed width palettes (Most common of the discrete palette) They have a set amount of colors which doesn’t change when the number of colors requested vary like the following palettes:

Dynamic palettes Where the colors of the palette depend on the number of colors you need like the green.pal palette from the cartography package:

Continuous palettes They provides as many colors as you need for a smooth transition of color:

This package includes 1771 from 50 different packages and information about these can be found in the following data.frames: palettes_c_names, palettes_d_names and palettes_dynamic_names

All the palettes can be accessed from the 3 functions paletteer_c(), paletteer_d() and paletteer_dynamic() using the by using the syntax packagename::palettename.

paletteer works as easy as just adding one additional line of code to your ggplot:

Example 1 :


library(paletteer)
library(ggplot2)

ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
  geom_point() +
  scale_color_paletteer_d("nord::aurora")

Example 2 : Same graphic but in different colors

use this line of code to customize the color of your visuals

scale_fill_paletteer_d(name of the palette)


ggplot(data = myData, aes(x = countryName, y = value, fill = countryName)) + 
  geom_col() +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_fill_paletteer_d("calecopal::lake") +
  labs(title = "Social Progress Index of different countries in 2019",
       x = "Countries",
       y = "Social Progress Index Score",
       colour = "Countries",
       caption = "Source: SKEMA Quantum Studio")


ggplot(data = myData, aes(x = countryName, y = value, fill = countryName)) + 
  geom_col() +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_fill_paletteer_d("palettetown::flareon") +
  labs(title = "Social Progress Index of different countries in 2019",
       x = "Countries",
       y = "Social Progress Index Score",
       colour = "Countries",
       caption = "Source: SKEMA Quantum Studio")

Conclusion

We hope this article helped you learn how to use the paletteer package to customize the color of you own visuals.

Sources


Follow SKEMA Global Lab in Augmented Intelligence

Warin, Thierry. 2019. “SKEMA Quantum Studio: A Technological Framework for Data Science in Higher Education.” https://doi.org/10.6084/m9.figshare.8204195.v2.

Citation

For attribution, please cite this work as

Gill & Warin (2020, March 12). Blog: paletteer. Retrieved from https://blog.skemagloballab.io/posts/2020-03-18-paletteer/

BibTeX citation

@misc{gill2020paletteer,
  author = {Gill, Anne Sophie and Warin, Thierry},
  title = {Blog: paletteer},
  url = {https://blog.skemagloballab.io/posts/2020-03-18-paletteer/},
  year = {2020}
}