Having trouble picking a color palette for your #Rstats visualization? Well here's a MEGA thread about all the ways you can choose a palette! 🧵[1/22]
We'll start off with the classics. First, you can use the palettes that are already a part of R's base code (keep in mind that these palettes were not necessarily designed to be colorblind-friendly)

[2/22]
The next classic set of palettes comes from {RColorBrewer}. You can use the command display.brewer.all(colorblindFriendly = TRUE) to see which palettes are colorblind-friendly.

(A guide to this package: datanovia.com/en/blog/the-a-…)

[3/22]
Another very popular package used for visualizations is {viridis}. The great thing about these palettes is that they're ALL colorblind friendly.

(Documentation: cran.r-project.org/web/packages/v…)

[4/22]
Now onto some lesser-known packages. This one is starting to gain popularity in the community: {wesanderson}. This package has a variety of palettes inspired by Wes Anderson films which are all colorblind-friendly.

(Documentation: github.com/karthik/wesand…)

[5/22]
Another package which was inspired by the wesanderson package is {ghibli} which has palettes inspired by Studio Ghibli movies which are also all colorblind-friendly. PonyoMedium is one of my favorites!

(Documentation: ewenme.github.io/ghibli/)

[6/22]
The package {ggsci} contains color palettes inspired by colors used in scientific journals (FYI, these palettes may not be the best choice when trying to create visualizations that are colorblind/printer/photocopy-friendly)

(Documentation: cran.r-project.org/web/packages/g…)

[7/22]
Get palettes that are used by Open Analytics (link: openanalytics.eu) using the package {oaColors}

(Documentation: cran.rstudio.com/web/packages/o…)

[8/22]
The Python package 'seaborn' has some great color palettes, including a color-blind friendly one. You can load these colors in manually using this R code from GitHub: github.com/timelyportfoli…

[9/22]
None of these preset palettes tickle your fancy? Make your own! There are a variety of packages and websites that can help you do this.

(Pictured: example of a visualization I made with a custom color theme)

[10/22]
If you don't want to use HEX codes, R has 657 built-in color names. See this cheatsheet for more information: nceas.ucsb.edu/sites/default/…

[11/22]
Generate some random colors using the package {randomcoloR} where you can specify things like hue and brightness. Here are a couple examples: hue="red" and luminosity="light"

(Documentation: github.com/ronammar/rando…)

[12/22]
Making an elevation map and want it to look like the actual place it's from? Use the package {earthtones} to derive a color palette from a particular location on Earth

(Documentation: cran.r-project.org/web/packages/e…)

[13/22]
Use the package {qualpalR} which, when given a number of colors (n) and an HSL color space, provides n colors which maximize smallest pairwise color differences.

(Documentation: github.com/jolars/qualpalr)

[14/22]
Use colors from the i want hue website (link: medialab.github.io/iwanthue/) with the R package {hues}

(Documentation: github.com/johnbaums/hues)

[15/22]
Another really interesting/cool way to build a custom color palette is to generate one from an image, which you can do thanks to the package {paletteR}

(Documentation: github.com/AndreaCirilloA…)

[16/22]
Use palettes from the website COLOURlovers.com with the R package {colourlovers}

(Documentation: github.com/andrewheiss/co…)

[17/22]
You can also create a palette on the website Data Color Picker (link: learnui.design/tools/data-col…) which generates palettes for you with lots of options, including viewing the palette on a dark background, and selecting a single-hue or divergent palette.

[18/22]
REGARDLESS of which method you use, please keep the colorblind community in mind. There are numerous tools out there to test whether your color palette is colorblind-friendly, I'll provide a couple that I use.

[19/22]
My personal favorite is the Viz Palette tool (link: projects.susielu.com/viz-palette) created by Elijah Meeks and Susie Lu.

[20/22]
There is also an R package {colorblindR} that simulates colorblindness on R figures.

(Documentation: github.com/clauswilke/col…)

[21/22]
I hope this thread inspired you to branch out and use fun color palettes! Happy plotting!

[22/22]

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Moriah Taylor (she/her) 🇺🇦

Moriah Taylor (she/her) 🇺🇦 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @moriah_taylor58

Apr 23, 2022
Found a really interesting survey, went to look at the results and the charts were physically painful to look at. So many #dataviz violations 😩 Here are some things I noted that should’ve been avoided:

A thread 🧵 (1/16)
1. PIE CHARTS - Unlike most data viz experts, I don’t completely *hate* pie charts. However, I think they should be used very sparingly and only when 2-3 categories are being represented.

(2/16) Pie chart showing 9 different categories/slices, each a diff
2. TOO MUCH COLOR - Each bar of a bar chart doesn’t need to be a different color. Besides the undesirable “rainbow effect”, it’s distracting and unnecessary. We know each bar represents a different category because they are labeled, so the extra encoding is not needed.

(3/16) Bar chart with 4 bars all colored differently in blue, green
Read 17 tweets
Jun 29, 2021
Sick and tired of the default R fonts? Here’s a comprehensive guide to using different fonts in ggplot2!

🧵 THREAD [1/15]
STEP 1: Find a font. There are many places to find fonts such as fontspace.com and fonts.google.com (which is what I use). Regardless of where you get your font, make sure you download it as a TrueType Font (.ttf) file!

[2/15]
STEP 2: Picking a font. It is best practice to use fonts that are legible as well as dyslexic-friendly. You can accomplish this by using Sans Serif fonts.

[3/15]
Read 15 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(