Question: Coloring single cell dimension-reduced plots in R, which palettes can handle high n?
1
gravatar for jrleary
8 months ago by
jrleary170
Lineberger Comprehensive Cancer Center
jrleary170 wrote:

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?

ggplot2 R • 212 views
ADD COMMENTlink written 8 months ago by jrleary170
2
gravatar for Friederike
8 months ago by
Friederike6.7k
United States
Friederike6.7k wrote:

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 COMMENTlink modified 8 months ago • written 8 months ago by Friederike6.7k

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

ADD REPLYlink written 8 months ago by jrleary170
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2455 users visited in the last hour
_