Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 2.89 KB

R_palettes.md

File metadata and controls

65 lines (48 loc) · 2.89 KB

Personal preferences regarding R palettes in combination with ggplot2

Required Packages

Or just get paletteer, which is a fantastic package that collects most color palettes in R

Preferred palettes

ggsci

  • Futurama
  • NEJM
  • JAMA
  • UChicago

wesanderson

  • Darjeeling1
  • FantasticFox1
  • Zissou1

RColorBrewer

  • Dark2
  • Set1
  • Paired

virdis

  • virdis
  • inerno

Useful functions

  • scale_color_gradient(), scale_fill_gradient() for sequential gradients between two colors

  • scale_color_gradient2(), scale_fill_gradient2() for diverging gradients

  • scale_color_gradientn(), scale_fill_gradientn() for gradient between n colors

  • scale_fill_grey(), scale_colour_grey() are always a classic

  • scale_color_viridis() and scale_fill_viridis() for virdis color scales

  • scale_colour_brewer and scale_fill_brewer for brewer scales

  • colorRampPalette() can be utilized to produce a larger number of colors than those available in a palette

    which subsequently can be fed to scale_color_manual() or scale_fill_manual()

    e.g. scale_color_manual(values = colorRampPalette(RColorBrewer::brewer.pal(8, "Dark2"))(16))

Useful pages

Color-blind friendly palettes

  • colorblind_pal(), scale_colour_colorblind(), scale_color_colorblind(), scale_fill_colorblind functions from ggthemes package
  • Use display.brewer.all(colorblindFriendly = TRUE) to see the colorblind-friendly palettes of RColorBrewer
  • Both virdis and ggsci have colorblind-friendly options.

For more details check these pages