Adding legend to Botton and top annotation in complexheatmap I have a heat map but top and bottom annotation don't have legend
Top_ha = HeatmapAnnotation(Group = anno_simple(top$Group, 
                                               col =structure(hue_pal()(length(unique(top$Group))), 
                                                              names = unique(top$Group)),
                                           border = TRUE, 
                                           height = unit(5, "mm")),
                       "Total Mutation Burden"=anno_barplot(clin$TMB, height = unit(15, &quot;mm&quot;), width=unit(30, &quot;mm&quot;),gp = gpar(fill = structure(hue_pal()(length(unique(clin$TMB))), 
                                                                                                                                               names = unique(clin$TMB)))))



Bottom_ha = HeatmapAnnotation(Response = anno_simple(clin$Response, 
                                                 border = T, 
                                                 col = structure(c("purple4", "grey"), names = c("Responders", "NonResponders")),
                                                 height = unit(5, "mm"),show_),
                          "TP53 Status" = anno_simple(clin$TP53_status, 
                                                          border = TRUE, 
                                                          col = structure(c(&quot;firebrick&quot;, &quot;grey&quot;), names = c(&quot;Mutant&quot;,&quot;Wild type&quot;)),
                                                          height = unit(5, &quot;mm&quot;)))


Right_Anno &lt;- HeatmapAnnotation(Signature = anno_text(right$Signature), which = &quot;row&quot;)

Heatmap(mat,
        bottom_annotation = Bottom_ha,
        top_annotation = Top_ha,
        name = &quot;Exposure&quot;,
        right_annotation = Right_Anno,
        show_row_dend = FALSE,
        show_parent_dend_line = FALSE,
        column_split = c(top$Group),
        column_title = c(&quot;Mutagenic&quot;, &quot;DDR Impaired&quot;, &quot;C&gt;A/T Dominant&quot;),
        col = colorRamp2(c( 0, 0.5), c(&quot;white&quot;, &quot;red&quot;)),
        show_column_names = FALSE)

As you are seeing Response, group and total mutation burden don't have any legend and annotation
Please can you help me to put legend for annotation?
I have tried annotation_lable but says Error: either provide levelsor provide namedcolors.
Also show_annotation_name = TRUE,show_legend = TRUE did not work
Answer from @ram-rs, converted from comment:
For the Group, try using it without the anno_simple. Just Top_ha = HeatmapAnnotation(Group=top$Group, &quot;Total Mutation Burden&quot; = ...), nothing else for Group. See if that generates a legend at all. We can customize later.hing else for Group. See if that generates a legend at all. We can customize later.