Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R color palettes for many data classes

Tags:

Are there any good packages for colour palettes in R that can handle many data classes? I have 16 sequential data classes. I tried RColorBrewer but it has a max of 9 data classes, I also tried rainbow() but its not appealing for sequential data. Thanks

like image 719
Julio Diaz Avatar asked Mar 05 '12 08:03

Julio Diaz


People also ask

How do you get different colors in R?

In R, colors can be specified either by name (e.g col = “red”) or as a hexadecimal RGB triplet (such as col = “#FFCC00”). You can also use other color systems such as ones taken from the RColorBrewer package.

Is viridis colorblind friendly?

viridis , and its companion package viridisLite provide a series of color maps that are designed to improve graph readability for readers with common forms of color blindness and/or color vision deficiency.


1 Answers

After much experimentation, I came up with the 25 colors that are mostly distinguishable. This is intended for classed data, not continuous/sequential data.

c25 <- c(
  "dodgerblue2", "#E31A1C", # red
  "green4",
  "#6A3D9A", # purple
  "#FF7F00", # orange
  "black", "gold1",
  "skyblue2", "#FB9A99", # lt pink
  "palegreen2",
  "#CAB2D6", # lt purple
  "#FDBF6F", # lt orange
  "gray70", "khaki2",
  "maroon", "orchid1", "deeppink1", "blue1", "steelblue4",
  "darkturquoise", "green1", "yellow4", "yellow3",
  "darkorange4", "brown"
)
pie(rep(1, 25), col = c25)

like image 157
Kevin Wright Avatar answered Sep 23 '22 08:09

Kevin Wright