Coloring single cell dimension-reduced plots in R, which palettes can handle high n?
1
1
Entering edit mode
3.9 years ago
jrleary ▴ 210

I'm looking to use something different than the built-in color palettes in Seurat, but I'm finding it very difficult to find packages that can handle 20+ discrete colors. I've looked through RColorBrewer and colorspace, as well as ggsci, and all max out around 12 colors from what I can see. Does anyone know of other color packages that can handle a higher number of colors, or am I best off using scale_color_manual() and doing it myself in ggplot2?

R ggplot2 • 1.6k views
ADD COMMENT
2
Entering edit mode
3.9 years ago

am I best off using scale_color_manual() and doing it myself in ggplot2

Yes.

Keep in mind though that there is a reason for the limit of discrete colors! It's not the computers or tools that have a problem distinguishing more than 12 discrete colors, it's the human perception that tends to be the limiting factor here!

That being said -- I don't know why you find that RColorBrewer is limited.

> library(RColorBrewer)
> colorRampPalette(rev(brewer.pal(n = 7, name =   "RdYlBu")))(20)
 [1] "#4575B4" "#5D8CC0" "#75A3CC" "#8DBBD8" "#A5CCE2" "#BEDDEB" "#D7EDF4" "#E6F5EC" "#F0F9DA" "#FAFDC8" "#FEFAB7"
[12] "#FEF0A8" "#FEE699" "#FDD78A" "#FDBD78" "#FCA267" "#FA8856" "#EE6A46" "#E24D36" "#D73027"
ADD COMMENT
0
Entering edit mode

Ah, I didn't think about grDevices. Thank you!

ADD REPLY

Login before adding your answer.

Traffic: 2474 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6