[R] save plot

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Jul 17 21:02:16 CEST 2010



On 17.07.2010 20:52, linda.s wrote:
>> Open a new device before plotting, do your plotting, close the device.
>>
>> For example, using a PDF device via pdf():
>>
>> pdf("my_plots.pdf", height = 8, width = 8, pointsize = 10,
>>     version = "1.4", onefile = TRUE)
>> for(i in 1:10) {
>>     y<- rnorm(100)
>>     x<- rnorm(100)
>>     plot(y ~ x)
>> }
>> dev.off()
>>
>> The last line (dev.off() is very important as the file will not be valid
>> pdf without closing the device.
>>
>> HTH
>>
>> G
>
> I got the error:
>> pdf("my_plots.pdf", height = 8, width = 8, pointsize = 10,
> +    version = "1.4", onefile = TRUE)
>> for(i in 1:10) {
> +    y<- rnorm(100)
> +    x<- rnorm(100)
> +    plot(y ~ x)
> + }
>> dev.off()
> null device
>            1
>



Which error??? Everyting went fine, as far as I can see.

Uwe Ligges



> ______________________________________________
> 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