Bitsy
Bitsy

Reputation: 303

Saving plot as jpg/tiff in R using ssh

I am using a particular R package called wTO (https://cran.r-project.org/web/packages/wTO/index.html)

One of the function which does the main computation also creates a plot among other things. As I am running the scripts on a CentOS server using SSH, I would like to save the plots. I am not sure where I should insert the commands for saving the plots. Kindly help.

The command is

> x= wTO.Complete(k = 32, n = 100, Data, Overlap, method = "p", method_resampling = "Bootstrap", pvalmethod = "BH", savecor = F, expected.diff = 0.2, lag = NULL, normalize = F, plot = T)

Upvotes: 0

Views: 175

Answers (1)

AEF
AEF

Reputation: 5650

You need to open a graphic device before you call the function:

http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/png.html

After opening every plot will be written to this device until you call dev.off().

So you would do:

jpeg(filename = "yourname.jpeg")
x= wTO.Complete(k = 32, n = 100, Data, Overlap, method = "p", method_resampling = "Bootstrap", pvalmethod = "BH", savecor = F, expected.diff = 0.2, lag = NULL, normalize = F, plot = T)
dev.off()

You can then use/transfer your plot saved in yourname.jpeg.

Upvotes: 1

Related Questions