Open AlirezaTafazzol opened 1 year ago
Basically, I am trying to replicate something like this: I can make a heatmap with legends and empty annotations on top. I can plot 'group1' and 'group2' texts on the RStudio plot, but I cannot add it to the heatmap and export outputs as a png or pdf file.
What do you mean by "but I cannot add it to the heatmap and export outputs as a png or pdf file."?
If you can see the plot in the figure panel in Rstudio, then you can simply output it to a pdf file.
pdf() draw(ht) group_block_anno(1:3, "empty", gp = gpar(fill = "red"), label = "group 1") group_block_anno(4:5, "empty", gp = gpar(fill = "blue"), label = "group 2") dev.off()
You can try this.
I am trying to combine the following plots/codes
ht <- draw(ht, annotation_legend_list = list(lgd_pvalue, lgd_sig))
andg1 <- group_block_anno(1:3, "empty", gp = gpar(fill = "red"), label = "group 1")
g2 <- group_block_anno(4:5, "empty", gp = gpar(fill = "blue"), label = "group 2")
But I don't know how to add g1 and g2 to the ht and output everything in the *png.ht + g1 draw (ht+g1) or etc. Does not work.
https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html