Question: ComplexHeatmap - Annotation without a named vector
0
gravatar for andrew.j.skelton73
3.3 years ago by
United Kingdom
andrew.j.skelton73320 wrote:

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 • 1.6k views
ADD COMMENTlink modified 3.3 years ago by jokergoo130 • written 3.3 years ago by andrew.j.skelton73320
Answer: ComplexHeatmap - Annotation without a named vector
2
gravatar for jokergoo
3.3 years ago by
jokergoo130
Germany
jokergoo130 wrote:

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 COMMENTlink modified 3.3 years ago • written 3.3 years ago by jokergoo130

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 REPLYlink written 3.3 years ago by andrew.j.skelton73320
1

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

ADD REPLYlink modified 3.3 years ago • written 3.3 years ago by jokergoo130

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

ADD REPLYlink written 3.3 years ago by jokergoo130
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 16.09
Traffic: 320 users visited in the last hour