[R] Device drivers - png()/jpeg()

Robert McFadden robert-mcfadden at o2.pl
Mon Apr 2 15:07:16 CEST 2007


 

> -----Original Message-----
> From: r-help-bounces w stat.math.ethz.ch 
> [mailto:r-help-bounces w stat.math.ethz.ch] On Behalf Of 
> Schmitt, Corinna
> Sent: Monday, April 02, 2007 2:58 PM
> To: r-help w stat.math.ethz.ch
> Subject: [R] Device drivers - png()/jpeg()
> 
> Hallo R-experts,
> 
> I produced a R graphic with the help of the following commands:
> 
> plot(0:4,0:4, type = "n", xlab = "X-Werte", ylab = "Y-Werte") 
> points(rnorm(100), rnorm(100), col = "black") locator(2, 
> type= "l") locator(2, type = "l", col = "red")
> 
> I could display this graphic by using windows() before 
> entering those commands. Now I want to save this graphic as 
> PNG file and JPEG file. I studied the online-help and the 
> manuals extensively but could not find a solution.
> 
> Can anyone tell me the corresponding command in detail?

png(file="plot_names.png") # for jpeg and pdf use:
jpeg(file="plot_names.jpeg") and pdf((file="plot_names.pdf")

plot(0:4,0:4, type = "n", xlab = "X-Werte", ylab = "Y-Werte")
points(rnorm(100), rnorm(100), col = "black") locator(2, type= "l")
locator(2, type = "l", col = "red")

dev.off()

Rob



More information about the R-help mailing list