Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed legend break for a series of heat maps for easy comparison #41

Open
gowthamee opened this issue Sep 5, 2018 · 3 comments
Open

Comments

@gowthamee
Copy link

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

@rlbarter
Copy link
Owner

rlbarter commented Sep 5, 2018

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)

@gowthamee
Copy link
Author

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 !!!

@rlbarter
Copy link
Owner

rlbarter commented Sep 7, 2018

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants