rmote icon indicating copy to clipboard operation
rmote copied to clipboard

pheatmap in rmote

Open taeyoungh opened this issue 7 years ago • 2 comments

Hello Ryan, I generate heatmap many times and my choice of R package is "pheatmap" in CRAN since it is sometimes hard to draw heatmap with ggplot. However, it seems that Rmote does not work well with this package, generating no plot at localhost page. Could you let me know any suggestion?

taeyoungh avatar Dec 07 '17 16:12 taeyoungh

Hi Ryan and @taeyoungh,

I've noticed this same behaviour recently. rmote is working perfectly for "simple" ggplot objects (i.e. just one plot, whatever the style) and for base R plots (with plot_done). However, for more complicated objects made up of several individual plots it won't show any plot at the localhost page. I've seen this for heatmaps (both with the pheatmap and superheat packages) and for multiple plots with plot_grid from the cowplot package.

For example, if I have two ggplot objects p1 and p2, they plot as expected individually, but not with plot_grid:

R> p1
 serving graphics through rmote
 Picking joint bandwidth of 2.15
 making thumbnail
 R> p2
 serving graphics through rmote
 Picking joint bandwidth of 2.04
 making thumbnail
!R> plot_grid(p1, p2)
 Picking joint bandwidth of 2.15
 Picking joint bandwidth of 2.04
 - not sending to rmote because another graphics device has been opened...
 - sending to the open graphics device instead...

Is this a known issue? Is there a workaround that can be applied?

Until I recently updated to R 3.4.3 and updated other packages (thinking especially of cowplot here) plot_grid worked fine, so maybe something changed in cowplot?

I love the package - if we could get it working for these compound plots then it would be just about perfect. If there's anything we can do to help, I'd be happy to.

Best, Davis

davismcc avatar Dec 15 '17 16:12 davismcc

It is likely related that this doesn't work with grid.arrange plots. Not sure if it's the non-default grobs that don't work.

dev.list()
# NULL
library(ggplot2)
library(gridExtra)
plot1 <- qplot(carat, data = diamonds, geom = "histogram", binwidth = 1)
plot2 <- qplot(carat, data = diamonds, geom = "histogram", binwidth = 0.1)
plot3 <- qplot(carat, data = diamonds, geom = "histogram", binwidth = 0.05)
grid.arrange(plot1, plot2, plot3, ncol=3)
dev.list()
# pdf
#   2

qplot(carat, data = diamonds, geom = "histogram", binwidth = 0.05)
# - not sending to rmote because another graphics device has been opened...
# - sending to the open graphics device instead...
# - to send to rmote, close all active graphics devices using graphics.off()
graphics.off()
qplot(carat, data = diamonds, geom = "histogram", binwidth = 0.05)
# works again

There have been no commits since mid-2017. @hafen, is there an intention to continue fixes/development on this package?

r2evans avatar Dec 16 '18 17:12 r2evans