[R] Can not save plot to png file correctly

Felipe Carrillo mazatlanmexico at yahoo.com
Mon May 31 21:34:21 CEST 2010


You can save as png like this too:

library(ggplot2)
data=data.frame(
  X=sample(10,1000,replace=T)
  , Y=letters[1:10])
png("mypng.png")
qplot(X, data=data, geom='histogram') + facet_wrap( ~ Y)
dev.off()
 
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA



----- Original Message ----
> From: Peng Yu <pengyu.ut at gmail.com>
> To: ggplot2 <ggplot2 at googlegroups.com>
> Sent: Mon, May 31, 2010 12:20:12 PM
> Subject: Can not save plot to png file correctly
> 
> library(ggplot2)

data=data.frame(
  
> X=sample(10,1000,replace=T)
  , Y=letters[1:10]
  
> )

p=qplot(X, data=data, geom='histogram') + facet_wrap( ~ Y)
save(p, 
> file='error.png')

The above qplot work properly if I don't plot it to a 
> file. But if I
plot it to a png file, the png file is always corrupted. Would 
> you
please let me know what is wrong?

-- 
> 
Regards,
Peng

-- 
You received this message because you are 
> subscribed to the ggplot2 mailing list.
Please provide a reproducible 
> example: http://gist.github.com/270442

To post: email > ymailto="mailto:ggplot2 at googlegroups.com" 
> href="mailto:ggplot2 at googlegroups.com">ggplot2 at googlegroups.com
To 
> unsubscribe: email ggplot2+> href="mailto:unsubscribe at googlegroups.com">unsubscribe at googlegroups.com
More 
> options: http://groups.google.com/group/ggplot2






More information about the R-help mailing list