Re: [R] Graphics on MacOSX

From: Charles and Kimberly Maner <ckjmaner_at_carolina.rr.com>
Date: Mon 08 Aug 2005 - 13:22:45 EST

Yet another approach is to create a postscript file on R for MacOSX and convert to a windows metafile is:

> postscript("test.ps", width=5.0, height=6.0, paper="special")
> xyplot(1~1)
> dev.off

Then, using the "free"/included MacOSX bundled software, GraphicConverter, convert the just-created postscript file to a WMF, (Windows Metafile Graphics), format. (This software has a batch conversion utility for converting multiple graphs--just select the multiple files and off you go.) Then, just import the newly converted .wmf files as you normally would into MS Word/MS Powerpoint. One (tiny) detail, though, is there is a bit of cropping you may have to do as the paper size, at least on mine, defaulted to letter, (which is the default). The paper size did not restrict itself to the 5"x6 " I specified earlier, but rather just the image size, (as advertised in the documentation.)

However, the final printed product is as you wish--quality commensurate with the Win32 version.

Good luck,
Charles

On Aug 4, 2005, at 9:13 AM, Martin Henry H. Stevens wrote:  

> This is a big issue for me, causing many days of angst. I finally
> stumbled on the following solution. I create a device save an image
> with postscript(). I then open it in Adobe Acrobat, select the area I
> want, enlarge to at least 400%, then copy, then paste into PowerPoint
> or Word. Alternatively, you can simply save a graphics image through
> the gui and it saves it as pdf. Then go through the steps of selecting,
> enlarging and copying in Acrobat. I am guessing real graphics programs
> would work as well (Photoshop or Illustrator), but I don't have those.
>
> Hank Stevens
>
>
> On Aug 4, 2005, at 8:03 AM, Weismann_D wrote:
>

>> Ist there a possibility on MacOSX to import Graphics into MSOffice  
>> Applications and resize them there without decreased quality? When I  
>> import  
>> via copy&paste I get low quality bitmaps and via import pictures (pdf)  
>> it is  
>> all the same. In the Windows versions of R there is the convienient  
>> way to  
>> use metafile format which can easily be resized in ppt and word. What  
>> is the  
>> equivalent way on MacOSX?  
>> Thanks, Dirk.  
 

You could try creating a PNG with bitmap() using a high resolution, e.g.,  

bitmap("test.png", type = "png256", res = 1200) plot(1:10, rnorm(10))
dev.off()  

Preview can read the resulting PNG file just fine and the Windows version of Office can insert PNGs, displays them well, and allows resizing. (I don't have an OS X version of Office so can't test that the OS X version would handle the PNGs equally well but I would have to assume it does.)  

bitmap() requires Ghostscript which I have installed on my system in /usr/local/bin. I'm not sure whether Ghostscript came with OS X or if I installed it myself but it's freely available.  

Hope this helps,  

Stephen  

PS I am using the out-of-the-box R.app:  

platform powerpc-apple-darwin7.9.0

arch     powerpc  
os       darwin7.9.0  

system powerpc, darwin7.9.0
status Patched
major 2
minor 1.0
year 2005
month 05
day 12  

and Ghostscript 8.13 (2003-12-31)

        [[alternative HTML version deleted]]



R-help@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 Received on Mon Aug 08 13:32:46 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:08:17 EST