Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
518 views
in Technique[技术] by (71.8m points)

slurm - Save a plot in R without png dev.off()

I am running an R script in a batch mode on my university Linux HPC cluster. I am using a module with pre-installed R packages, so I don't think I can install anything. R version is 4.0.3

I am trying to save the plots with

png("filename.png")
plot()
dev.off

But I got a "unable to start device png" error with "unable to open connection to X11 display ''" warning

I found some similar problems here, but neither of the suggested solutions worked. I tried

options(bitmapType='cairo')
png("plot.png", res=250, height=40, width=80)
plot()
dev.off()

and

png("plot.png", type='cairo', res=250, height=40, width=80)
plot()
dev.off()

still have the same error

Are there other ways to save a plot without using png() and dev.off()?

UPD: I checked capabilities() and both png and jpeg are FALSE there. Is there any way I can at least look at those plots? I do not have to save them

question from:https://stackoverflow.com/questions/65940929/save-a-plot-in-r-without-png-dev-off

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...