[R] Saving plots to file

Cedrick Johnson cedrick at cedrickjohnson.com
Mon Aug 10 18:45:24 CEST 2009


Try this:

png(file="Desktop/hist1.png")
plot(glm1$residuals,gain,main =  "Hist of residuals and gain")
dev.off()

-c

Sean MacEachern wrote:
> Appologies if this has been addressed before, but I can't seem to find it in
> the help archives.
>
> I'm looking to do something like the following but it looks like save.plot
> is deprecated.
>
> save.plot(plot(glm1$residuals,gain,main = "Hist of residuals and
> gain"),file="Desktop/hist1.png")
>
>
> Thanks in advance,
>
> Sean
>
> Session Info:
>
> R version 2.9.1 (2009-06-26)
> i386-apple-darwin8.11.1
>
> locale:
> en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] tools_2.9.1
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list