jokergoo / ComplexHeatmap

Make Complex Heatmaps
https://jokergoo.github.io/ComplexHeatmap-reference/book/
Other
1.29k stars 225 forks source link

picking new set of random colors for annotations #1160

Open rikrdo89 opened 8 months ago

rikrdo89 commented 8 months ago

I have a dataframe AnnoCat with 3 classes ("Run", "Treatment", "Sequencer") and I use CatAnnotation <- HeatmapAnnotation(df = AnnoCat) to create the annotations for my heatmap.

set.seed(123)
Heatmap(as.matrix(myTB), 
        name = "Corr", 
        col = colorRamp2(c(0, 0.5, 1), hcl_palette = "Spectral",
        top_annotation = CatAnnotation)

however, the default colors for the annotations are hard to distinguish. Is there a way to avoid manually assigning colors to each of the variables in each of the classes? I tried changing the set.seed() to see if that would change the random colors that get picked for the annotation, but it did not change the colors at all.

image