This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to change/remove name of annotation ComplexHeatmap package?

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

complexheatmap r rna-seq annotations

0 answers

No answers yet.

Log in to answer this question.