[R] Problems with png()

Arne Henningsen ahenningsen at email.uni-kiel.de
Mon Sep 6 15:28:50 CEST 2004


On Monday 06 September 2004 12:05, Laura Quinn wrote:
> On Mon, 6 Sep 2004, Barry Rowlingson wrote:
> > Laura Quinn wrote:
> > > I am trying to save a series of plots as .png files by using
> > >
> > > png(file="myfile.png",bg="transparent")
> > > dev.off()
> > >
> > > for each image plot I produce. Unfortunately when I have tried this I
> > > am unable to open the files, and am told they are corrupted.
> > >
> > > I have tried to use the jpeg() function but have the same problem. The
> > > only way I have managed to export a graphic successfully is as
> > > dev.copy2eps. Aside from producing unwieldy files, this is also
> > > unhelpful as I at m hoping to create a movie of the images via
> > > ImageMagick.
> >
> >   This sounds a bit obvious, but are you doing your plot commands
> > _between_ the png() call and the dev.off() call?
> >
> >   Try:
> >
> >   png(file="foo.png")
> >   plot(1:10)
> >   dev.off()
> >
> >   What version/platform are you using?
>
> Yes, I have been using the above call to no avail. I'd be suprised if my
> libpng wasn't up-to-date on SuSe 9.0, but I'm not sure how to check which
> version I have?

I have also SuSE 9.0 and R-1.9.1, but I have no problems with png(). Did you 
compile R from source or did you install it from a rpm file?

To figure out your version of libpng type on a console:
rpm -qa libpng*

I get:
libpng-devel-1.2.5-194
libpng-1.2.5-194

"libpng-devel" is only necessary if you compile R from source.

You may send me the file foo.png generated by Uwes code. Then, I can try to 
open it - just to eliminate the possibility that your png viewer is broken.

Best wishes,
Arne

> Laura
>
> > Barry
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

-- 
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
ahenningsen at agric-econ.uni-kiel.de
http://www.uni-kiel.de/agrarpol/ahenningsen/




More information about the R-help mailing list