Its possible to remove annotation names using anno_simple in ComplexHeatmap
0
0
Entering edit mode
nromerov • 0
@3ef12fd6
Last seen 19 hours ago
Colombia

Hello

Im trying to plot a heat map with the code bellow


row_anno <- rowAnnotation(
  CellType = anno_simple(cell_classification$cell_type, col = cluster2celltype_colors),
  CellSubtype = anno_simple(cell_classification$cell_subtype, col = cluster2cellsubtype_colors)
)

col_anno <- columnAnnotation(
  Relationship = anno_simple(module_classification$module_relationship, col = module2relationship_colors),
  Module = anno_simple(module_classification$modules_names, col = module2colors_colors)
)

cell_type_legend <- Legend(
  labels = names(celltype2colors),  # Cell type names
  legend_gp = gpar(fill = celltype2colors),  # Corresponding colors
  title = "Cell Type"
)

cell_subtype_legend <- Legend(
  labels = names(cellsubtype2colors),  # Cell subtype names
  legend_gp = gpar(fill = cellsubtype2colors),  # Corresponding colors
  title = "Cell Subtype"
)

module_relationship_legend <- Legend(
  labels = names(relationship2colors),  # Relationship names
  legend_gp = gpar(fill = relationship2colors),  # Corresponding colors
  title = "Module Relationship"
)

scale_legend <- Legend(
  col_fun = colorRamp2(c(0, 30), c("white", "#B57EDC")),
  title = "Shared Genes",
   at = c(0, 10, 20, 30),
  labels = c("0", "10", "20", "30")
)

vertical_legends <- packLegend(
  module_relationship_legend,
  cell_type_legend,
  direction = "vertical",  
  row_gap = unit(5, "mm")  
)

atlnet_legends <- packLegend(
  cell_subtype_legend,
  vertical_legends,
  direction = "horizontal", 
  column_gap = unit(5, "mm")  
)

combined_legends <- packLegend(
  scale_legend,
  atlnet_legends,
  direction = "vertical",  
  row_gap = unit(5, "mm")  
)

lhm <- Heatmap(modules_leiden_matrix, name = "Shared Genes", 
        col = colorRamp2(c(0, max(modules_leiden_matrix)), c("white", "#B57EDC")),
        cluster_rows = FALSE, cluster_columns = FALSE,
        left_annotation = row_anno,  
        top_annotation = col_anno,    
        show_row_names = FALSE,       
        show_column_names = FALSE,
        show_heatmap_legend = FALSE
)

draw(lhm, annotation_legend_list = combined_legends)

and i got this enter image description here

Someone know how can i remove the labels from the annotations of the heatmap?

ComplexHeatmap • 26 views
ADD COMMENT

Login before adding your answer.

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