[R] tyring to save plots using windoze 7 and cygwin

Peter Dalgaard pdalgd at gmail.com
Sun Oct 3 01:34:35 CEST 2010


On 10/03/2010 12:43 AM, Mike Marchywka wrote:
> 
> 
> Hi,
> I'd been using R in the past and recently installed it on a new windoze 7 machine.
> There have been many issues with compatibility and 32/64 bit apps etc and I did
> find on google on isolated complaint that saveplot failed in scripts a long time ago.
> R seems to work fine except script-based plot saving as pdf has not worked.
> I have tried the following, none of which seem to function,
> 
> 
> xyz <-read.table("time_frac2")
> x=plot(xyz,main="imp rate", xlab="Time(GMT)",ylab="imp/minute")
> grid()
> 
> dev2bitmap("xxx.pdf",type="pdfwrite")
> save.plot(x,file="xxx.pdf",format="pdf")
> dev.copy("pdf","auto_pdf.pdf")
> dev.off()
> savePlot("./auto_hit_rate.pdf",type="pdf")
> 
> q()
> 
> 
> 
> Now apparently R does save the plot in a default file Rplots.pdf which is
> just fine for my immediate needs but this may have limitations for future
> usages.
> 
> Just curious to know what other may have gotten to work or not work.

You likely do not have plot recording on the device you open by default
in batch processing. Copying to a different device relies on that.

I'd just open the pdf device explicitly:

pdf(file="foo.pdf")
plot(xyz,main="imp rate", xlab="Time(GMT)",ylab="imp/minute")
grid()
dev.off()

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list