Open go-ski opened 6 years ago
The plots seem to get created. I'm not sure what's causing the error to print.
Sorry, I forgot to mention, the plots are produced. Just noticed the error is coming from remoter. Seems to be related to current rpng.off() issue for remoter.
@go-ski I have some fixes of remoter
for this. Please test this version before I send a PR. Thanks.
Yes, dev.off()
is hijacked as needed, but the pdf()
does not need interaction and pipe the plot to file. So, there is no need to return the image and re-plot it at client. This is the same for all other image file types.
No changes to the pbdCS
.
Thanks @snoweye. The new version fixes things for the plot example I gave.
My original issue that I reduced to the example was actually with ggplot2. Can you run the ggplot example below (at the pbdR: prompt) to see if it produces both plots correctly? I get rank 0 correct but rank 1 seems to only make the pdf()
result without the ggplot()
.
library(pbdMPI)
library(pbdCS)
library(ggplot2)
dat = data.frame(x = rnorm(100), y = rnorm(100))
pdf(file = paste0("plot", comm.rank(), ".pdf"))
ggplot(dat, aes(x, y)) + geom_point()
dev.off()
@go-ski pbdR> print(g)
where g
is a ggplot object will work for both ranks. Regular plot()
or print()
will not have this problem. The default R> g
will display to console, but R> print(g)
will go to where you want it to. This is the same under remoter>
and pbdR>
. However, currently pbdCS
may only get returns from rank 0 that was the results you got (only rank 0 was saved). (Right? @wrathematics)
@wrathematics How do I trace/print returns from ranks other than 0? (I can not remember we seem talk about this before ...) In @go-ski case, the rank 1 seems print the ggplot object to somewhere, I need to know where and how I can pipe them to file ggplot2 uses funny ways differently.
Appears that replacing dev.off()
with grid::grid.draw(myplot)
as in the following (replacing my earlier snippet):
pdf(file = paste0("plot", comm.rank(), ".pdf"))
myplot = ggplot(dat, aes(x, y)) + geom_point()
grid::grid.draw(myplot)
is currently a workaround for ggplot2 that does not get hijacked and produces all plots.
When managing own plotting devices on each rank to make plots in parallel, such as this code given at the pbdR: prompt:
I get the following error:
Is plotting being hijacked into another file by default? What am I missing?
This is pbdCS version 0.2-0 on R 3.4.2.