ComplexHeatmap - Annotation without a named vector
1
0
Entering edit mode
@andrewjskelton73-7074
Last seen 5 weeks ago
United Kingdom

Hi, 

I'm trying to make a few heatmaps dynamically, however I'm having a bit of trouble when trying to make the annotation object.

According to the guides, you need to provide a named vector to the col argument in HeatmapAnnotation function, however I can't do that when generating dynamically, as there's different annotations. I've tried an un-named vector, but I get the following error every time:

Error in ColorMapping(name = name, colors = col, na_col = na_col) : 
  either provide `levels` or provide named `colors`.

Code:

  ha = HeatmapAnnotation(df  = df, 
                         col = list(type = c("black", "red")))

Any suggestions? - I feel like I've missed something obvious but can't seem to nail it down.

Thanks, 

 

complexheatmap • 6.4k views
ADD COMMENT
2
Entering edit mode
jokergoo ▴ 200
@jokergoo-8506
Last seen 21 months ago
Germany

in following code:

 ha = HeatmapAnnotation(df  = df, 
                         col = list(type = c("black", "red")))

change `c("black", "red")` to a vector with names that names correspond to the levels in `df$type` so that we can correctly map colors to `df$type`.

ADD COMMENT
0
Entering edit mode

Hi, I was wanting to do this without a named vector, is there any way for the col argument to automatically take the first element of the vector, for the first level in the data frame column, for example?

ADD REPLY
1
Entering edit mode

Hi, now it is supported in the newest version. You can update it by `devtools::install_github("jokergoo/ComplexHeatmap")`

ADD REPLY
0
Entering edit mode

En, not in current version, but I will support it in future versions.

ADD REPLY

Login before adding your answer.

Traffic: 863 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