MLUG: [MLUG] R is nice
[MLUG] R is nice
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
We've been using R to make some stat graphs and I just thought I'd say a few words. R is GPL and a top stat package. All the academic statisticians are using it these days.

We were having some trouble getting what we wanted out of a scatter plot. We were trying to write to a png image, but it was tricky to control the sizes of elements like text and points and the fonts looked awful -- like small fonts had been amplified so that blocky pixelation was highly visible. Eventually we realized that we had to use a vector graphics approach and convert to raster graphics using an external program. This worked like a charm.

R allows use of postscript or pdf output devices. We tried both. The problem with postscript was that the aspect ratio didn't seem to hold when the image was displayed -- we were using kghostview and it would always stretch it out to fit the page size it was using. There might be a way around this problem, but we found it easier to use the pdf output instead. Saving the output as graph.pdf, I used this ghostscript command to make a .png file from the .pdf file:

gs -q -dBATCH -dNOPAUSE -dLastPage=1 -sDEVICE=png16m -r333.333 -sOutputFile=graph.png graph.pdf

The graph is considered to be 6-inches (square) so the use of -r333.333 gives us 333.333 dots per inch and a total of 2000x2000 pixels in the output .png file. It can also do bmp or jpg or others:

http://pages.cs.wisc.edu/~ghost/doc/cvs/Devices.htm

We wanted an image for someone to import into PowerPoint (I guess it's OK with .png files now though it didn't used to be). I think most people I know are just importing encapsulated postscript into TeX documents. You can probably control the aspect ratio pretty easily then.

Mike

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members