R color cheat sheets and how to choose the right color for your research results?

R color cheat sheets and how to choose the right color for your research results?

Finding a suitable color scheme is challenging for scientific data representation. If you choose the wrong colors, your graphs may not show what you want. You can use R color cheat sheets to choose the best colors for your research results charts. Also, you need some basic information about color and R. Here we have some tips to improve your research results representation: 

  • The first thing is that do not forget color blind people before visualization. R has packages to help improve your outputs that are accessible for color blind and dichromats. dichromat package will give you color schemes for dichromats
  • R has three types of colors hexadecimal colors, named colors, and integers referring to positions in the color palette.
  • Hexadecimal colors mean a base-16 number system used to describe color. Actual colors, Red, green, and blue, are each represented by two characters which have 16 possible symbols (symbols are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F). : 
  • Zeros means it is black, black=#000000 and Fs means it is white, white = #FFFFFF. 
  • To see 657 built in colors in R type this code: colors() 
  • If you are not familiar with color theory, preferring a color palette is better for plots. R has several good color palette packages (colorspace, RcolorBrewer, Wes Anderson color palettes, grDevices, and colorRamps

R color cheat sheets

If you wish to choose your colors for your R visualization, you can use color cheat sheets. The cheat sheet made by Dr. Ying Wei is handy. This document contains a list of R colors names with colors. 

Choosing an R color according to the background is the more straightforward way. You can find different cheat sheets for this purpose. R colors on the black background cheat sheet for R are here, And colors on the white background for R is here.

Bonus example for R color package:

RColorBrewer on of the most popular color packages for life sciences research. And you can easily install and use this R package.

How to install and check the colors of RColorBrewer: 

install.packages(“RColorBrewer”)

library(“RColorBrewer”)

display.brewer.all()

Are you a beginner in R? Check out our online live R classes for this month and learn R easily with the trainer.