Entering edit mode
4.4 years ago
camillab.
▴
160
Hi,
How do I remove the label that is next to the annotation box in the heatmap with ComplexHeatmap ideally I would like to create a block annotation with the name of the sample in it but so far I wasn't able to do it. Also which RGB color is the best to have blue and red and not purple-bluish color in the heatmap? I have 3 samples (ctrl) and 3 treatments. I want the samples in columns and the genes in rows. here my code:
#load libraries
library(grid)
library("ComplexHeatmap")
library(circlize)
#set color heatmap
colr = colorRamp2(
seq(min(mydata), max(mydata), length = 3),
c("#000099", "#EEEEEE", "#FF0000"),
space = "RGB")
# annotation
df = data.frame(sample = c(rep("CTRL", 3), rep("GENT", 3)))
ha = HeatmapAnnotation(
df = df,
col = list(sample = c("CTRL" ="black", "TREAT" = "yellow")),
simple_anno_size = unit(2, "mm")
)
a <- Heatmap(t(mydata),
name = "z score", #title of legend
width = unit(8, "cm"), height = unit(8, "cm"),
show_column_names = FALSE,
column_title = " ",
row_title = "Genes",
col= colr,
border = TRUE,
column_names_gp = grid::gpar(fontsize = 9),
column_title_gp = gpar(fontsize = 11),
row_title_gp = gpar(fontsize = 11),
clustering_distance_rows= "euclidean",
clustering_distance_columns= "euclidean",
clustering_method_rows = "ward.D2" ,
clustering_method_columns="ward.D2",
row_dend_side = "left",
top_annotation = ha)
draw(a, merge_legend = TRUE) # join the two legends
thank you very much!
Camilla
This question ideally belongs on https://support.bioconductor.org/. Please add a sample output image so we can visualize your requirement better.
thank. I did few times but I never received any answer. but I will try! thank you foo1 one labels next to the annotation not in the legend, how do I change fontsize or remove it?
I don't know if I uploaded correctly. otherwise any annotation in this page have label next too it (e.g. foo1 first heatmap) :
https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.htmlenter link description here
Answer now on Bioconductor: https://support.bioconductor.org/p/131791/