[R-SIG-Mac] How to put nice R graphics into powerpoint

Simon Urbanek simon.urbanek at r-project.org
Fri Feb 11 17:12:08 CET 2005


Hi Phil,

some of the discussion went into private e-mails so I guess I'll fill 
some pieces here for the list.

On Feb 10, 2005, at 5:34 PM, Phillip Price wrote:

> I usually create a PDF with R, and import it into Powerpoint for the 
> mac.  The results are fuzzy and not good.  I don't have Illustrator.  
> For final presentations I sometimes send the pdf to a colleague who 
> has Illustrator, who converts it for me.

It's better to use PhotoShop (if you have it) than Illustrator - AI 
doesn't handle objects with alpha component well and has some other 
quirks. PS rendered all graphics I had perfectly and allows flexible 
resolution settings and many more output formats.

Other solution is to use R directly to produce hi-res bitmaps instead 
of PDF. You'll need to tweak the settings to get a good output, though.

> For weeks I've been intending to find a better way to do things, 
> assuming that there must already be a solution in the R community and 
> that I had just been too lazy to track it down.  If, instead, the 
> actual state of things is that R cannot produce output that can be 
> used well in the world's most popular presentation software, then I 
> think this should be a fairly high-priority item.  (Of course, I say 
> this from the standpoint of someone who will not actually be doing the 
> work to implement a change, so, easy for _me_ to say)!

The fact is that R can produce "output that can be used well in the 
world's most popular presentation software" if you're using the 
"world's most popular" operating system. That is the reason why it 
becomes a very low priority item as your argument backfires ;).

For the record - Cocoa doesn't support PICT (neither vector nor 
raster), so we can't go that way. Carbon + QuickDraw supports PICT, but 
that GD is very old and incompatible with the current R - bad luck 
again (volunteers are free to take the old code, port it to the current 
R and add PICT support...). Another possibility would be to tweak the 
Win32 R code and use libEMF - again a lot of work that may or may not 
lead to the desired result.

Finally some good news ;). After some tweaking and bug-fixing I was 
able to compile pstoedit and libEMF for OS X. The output isn't exactly 
great, but people who can live with PowerPoint won't notice or mind 
either, so there it goes:
http://www.rosuda.org/misc/pstoedit
That's the binary (statically linked, so nothing else needed). Just 
download, run
chmod a+x pstoedit
on it in Terminal after downloading and you're ready to go. It's a 
command-line tool, of course, and I highly recommend using the -pta 
flag. Furthermore due to the limitations of EMF format, you may be 
better off scaling the image to get somewhat more reasonable result, so 
you could use something like:
pstoedit -pta -xscale 16 -yscale 16 test.pdf test.emf
The reason why scaling makes a difference is that EMF uses integer 
precision and the grid of possible points is very coarse by default.

BTW: although the name says "ps..." it actually works much better with 
R's PDF files than PS. Chances are that you'll need GhostScript in 
/usr/local/bin - but I guess everyone has that, right?

In conclusion I can't help but to say, get Keynote if you can - you'll 
save yourself a lot of work and you presentation will look nicer than 
everyone else's that use PP (in terms of rendering and features - the 
content is still up to you ;)). If people insist that you use a PC for 
presentation, you can still use QT without compromising the quality of 
your talk. (Any flames in PT, please ;)).

Cheers,
Simon



More information about the R-SIG-Mac mailing list