[R] Saving R Graph to a file

R. Michael Weylandt michael.weylandt at gmail.com
Sun Nov 4 09:29:39 CET 2012


On Sun, Nov 4, 2012 at 4:16 AM, frespider <frespider at hotmail.com> wrote:
> Hi
>
> I am not sure why I can't get my plot saved to a file as .ps, I searched
> online and I found that I have to use something is called postscript,png or
> pdf function which I did but still not working.
>
> Actually what I have is a matrix with almost 300-400 columns. I need to
> create a histogram and boxplot for some columns as .ps file (with reasonable
> size if i can adjust that would be nice also) so I can import them in my
> latex code to display a good chart on my report.  And I found out R display
> a certain limit of device.
> Can you please help me code this?
>
> This an example I create
> data(CO2)
> png(filename="C:/R/figure.png", height=295, width=300,  bg="white")
> hist(CO2[,4])
> device.off()

Did you try running your own code? It should have thrown an error here
since there's no device.off() function.

You just want dev.off()

Michael




More information about the R-help mailing list