How to increase the size of the top annotation bars in Complexheatmap
1
0
Entering edit mode
3 months ago

Hi,

I have generated a heatmap through complexheatmap package in R and was wondering how to increase the size of the top annotation bars. I tried couple of things, however, unsuccessful. Please assist me with this.

Example of the code:

column annotations

ha_column = HeatmapAnnotation(df = data.frame(Condition = Sample_info$Condition,
                                              Infection_Type = Sample_info$Type,
                                              GSE_ID= Sample_info$GSE_ID),
                              show_annotation_name = TRUE,
                              col = list (Condition = c("Sepsis" = "#520f57",  "Ecoli" = "#b1fcf2", "Saureus" = "#5caba0", "Bmeningitis" = "forestgreen", "SevereH1N1" = "#c99dfa"),
                                          Infection_Type = c("Bacterial" = "#64C0FE", "Bacterial_Viral" = "magenta", "Viral" = "orange", "Unspecified" = "brown", "Mixed" = "green"),
                                          GSE_ID = c("GSExxx1" = "cyan", "GSExxx2" = "pink", "GSExxx3" = "purple", "GSExxx4" = "grey", "GSExxx5" = "red", "GSExxx6" = "salmon")))

Export plot

pdf(paste0("./Ind_analysis_fingerprints_Module_Gen3_individual_without_healthy_control_v1.pdf"), height = 70, width = 100)
hmap <- Heatmap(df_plot,
                col = bluered(75), 
                cluster_rows = TRUE,
                cluster_columns = FALSE,
                row_split = ann_table$Cluster,
                top_annotation = ha_column,
                left_annotation = row_ha,
                row_title_rot = 0,
                name = "% Response",
                row_names_max_width = unit(10,"in"),
                row_title_gp = gpar(fontsize = 12),
                column_names_gp = gpar(fontsize = 6.5),
                row_names_gp = gpar(fontsize = 12))

draw(hmap, heatmap_legend_side="left", annotation_legend_side="left")
dev.off()


Error in Heatmap(df_plot, col = bluered(75), cluster_rows = TRUE, cluster_columns = FALSE,  : 
  unused argument (top_annotation_height = unit(5, "cm"))

Thank you,

Toufiq

plot annotation ComplexHeatmap heatmap • 231 views
ADD COMMENT
0
Entering edit mode
3 months ago

Adding simple_anno_size = unit(3, "cm") to the column annotation (see below) resolved the issue. Thank you.

ha_column = HeatmapAnnotation(df = data.frame(Condition = Sample_info$Condition,
                                              Infection_Type = Sample_info$Type,
                                              GSE_ID= Sample_info$GSE_ID),
                              show_annotation_name = TRUE,
                              col = list (Condition = c("Sepsis" = "#520f57",  "Ecoli" = "#b1fcf2", "Saureus" = "#5caba0", "Bmeningitis" = "forestgreen", "SevereH1N1" = "#c99dfa"),
                                          Infection_Type = c("Bacterial" = "#64C0FE", "Bacterial_Viral" = "magenta", "Viral" = "orange", "Unspecified" = "brown", "Mixed" = "green"),
                                          GSE_ID = c("GSExxx1" = "cyan", "GSExxx2" = "pink", "GSExxx3" = "purple", "GSExxx4" = "grey", "GSExxx5" = "red", "GSExxx6" = "salmon")),
            simple_anno_size = unit(3, "cm"))
ADD COMMENT

Login before adding your answer.

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