superheat
superheat copied to clipboard
Fixed legend break for a series of heat maps for easy comparison
Hi, I am using legend.breaks and trying to generate multiple heat maps. My question is how to set the legend breaks, such that it stays at fixed positions, while generating a series of heat maps through if/for loop. This will help with easy comparison, as colors point to a specific value. Any help is appreciated.
Thanks, Gowthamee
Have you tried the legend.breaks
argument? https://rlbarter.github.io/superheat/legend.html#legend-breaks
(ensure you're using the github version, rather than the CRAN version)
I use the GitHub version of superheat and I use the argument legend.breaks. Below is the code:
superheat(TermFoldCh, heat.col.scheme = "viridis", grid.hline = TRUE, grid.vline = TRUE, grid.hline.size = 0.4, grid.vline.size = 0.4, grid.hline.col = "white", grid.vline.col = "white", force.grid.hline = TRUE, pretty.order.rows = TRUE, row.dendrogram = TRUE, dist.method = "euclidean", legend = TRUE, legend.height = 0.1, legend.width = 0.5, legend.text.size = 5.0, legend.vspace = 0.0000000001, legend.breaks = c(-20,-15, -10, -5, -2.5, 0, 2.5, 5, 10, 15, 20), bottom.label.text.alignment = "center", bottom.label.text.col = "black", bottom.label.text.size = 2.0, bottom.label.text.angle = 0, bottom.label.size = 0.1, bottom.label = "variable", bottom.label.col = "white", left.label.size = 0.25, left.label.text.size = 4.0, left.label.text.col = "black", left.label = "variable", left.label.col = "white", left.label.text.alignment = "right", force.left.label = TRUE, title = substr(TermName, start = 1, stop = 51) title.size = 4.0, title.alignment = "center", padding = 0.5, print.plot = TRUE)
dev.off()
However, in the figure generated by the code, the legend does not have the full range of numbers included in the legend.breaks, and hence it varies between the heat maps, which makes it difficult to compare heatmaps, as colors on different heat maps point to a different fold change values.
thanks !!!
Perhaps also set the heat.lim
argument? It would be great if you could provide a reproducible example so I can play with it myself (I don't have access to the TermFoldCh matrix).