Open epurdom opened 7 years ago
+1 for this! pheatmap looks really good and perhaps is more robust than aheatmap.. On Fri, Sep 29, 2017 at 7:45 AM Elizabeth Purdom notifications@github.com wrote:
Look into using pheatmap which is like aheatmap but puts names on side (like my hack does, but built into the function, and also for genes).
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/epurdom/clusterExperiment/issues/224, or mute the thread https://github.com/notifications/unsubscribe-auth/AID1aG62MQGgott9l2BRJOl_VmGC2HvSks5snNhegaJpZM4Poj5r .
@drisso One question I had was whether pheatmap works with par(mfrow=c(1,2)) so that you can do side by side heatmaps (or other graphs) with pheatmap? I've just fixed a bug in plotHeatmap
so that now it uses this feature reliably.
I think the first step would be an option to switch between them. Which would be complicated because their arguments are called different things, so all of the arguments that people just pass to aheatmap would not work with pheatmap.
Indeed par(mfrow=c(1,2))
doesn't work with phatmap
but does work with aheatmap
:
test = matrix(rnorm(200), 20, 10)
test[1:10, seq(1, 10, 2)] = test[1:10, seq(1, 10, 2)] + 3
test[11:20, seq(2, 10, 2)] = test[11:20, seq(2, 10, 2)] + 2
test[15:20, seq(2, 10, 2)] = test[15:20, seq(2, 10, 2)] + 4
colnames(test) = paste("Test", 1:10, sep = "")
rownames(test) = paste("Gene", 1:20, sep = "")
par(mfrow=c(1,2))
pheatmap(test)
pheatmap(test, kmeans_k = 2)
pheatmap
does use the grid graphics package, but I suspect that it clears existing grid layouts so you can't use grid to get them side-by-side (seen something suggesting that on posts). The following, based on my limited grid
knowledge, should work to put pheatmap
on one side and text on the right but it doesn't. So it doesn't seem easy to go outside of it to make side-by-side.
grid.newpage()
pushViewport(viewport(layout=grid.layout(ncol=2, nrow=1)))
pushViewport(viewport(layout.pos.col=2, layout.pos.row=1))
grid.rect()
grid.text("Right side")
popViewport(1)
pushViewport(viewport(layout.pos.col=1, layout.pos.row=1))
pheatmap(test)
popViewport(2)
Indeed aheatmap
was originally a fork off of pheatmap
and it sounds like side-by-side heatmaps were a big goal.
Side-by-side is a big feature for me, but I agree working within RStudio is pretty important for many.
Yeah, I understand your point.
I'm using RStudio and R markdown pretty much all the time now, so I never use side-by-side graphs and having a heat map that works with RStudio is a big plus for me.
Perhaps the only way around this would be to give the option of using one or the other. But I'm not sure this is ideal either... especially because it will require some non-trivial adjustments to the plotHeatmap functions.
Look into using pheatmap which is like aheatmap but puts names on side (like my hack does, but built into the function, and also for genes).