Skip to content

How to put nice R graphics into powerpoint

8 messages · Denis Chabot, Phillip Price, Simon Urbanek +2 more

#
Well I really appreciate the efforts and the willingness to help of 
people on this list, but I agree that the pict format has no future and 
I'd hate to see Stefano's precious time being invested in working on a 
R device for it, considering that I can produce png with acceptable 
quality, bot with R when R11 is running and in Illustrator, by choosing 
export instead of save for office or save for the web. All three of 
these export options save to png format, but only the first one allows 
you to specify resolution. By cranking up resolution (150 instead of 
the default 72) I managed to create png graphics that do not look fuzzy 
in PowerPoint.

I am very surprised, however, that all those picture converters out 
there only export to raster pict even when the starting format is 
vector.

I don't really wish to see any effort going into a wmf device for R 
either, as wmf does not "always" import well into PowerPoint anyway. 
Some weird things often happen.

And finally, I don't intend to stay on a 1998 vintage PB for much 
longer, I'll buy my own computer in the next few months if my employer 
does not allow one. And then I can try Keynote!

Denis
Le 10 f?vr. 2005, ? 20:14, Simon Urbanek a ?crit :
#
I would really like to find a solution to this, though, even if Denis 
can live without it!  Some colleagues insist on exchanging Powerpoint 
slides directly when we are preparing a presentation.

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.

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)!

Anyway, I would love to see some kind of solution for this, though I 
don't know what that solution might be.

To those of you who continually work to make R better: thanks!

--Phil Price
#
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:

            
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.
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
#
Good to know.  But I don't have PS either.
This is probably the way to go, actually.  Believe it or not, I had not 
realized there was a way to make R produce bitmaps!
By that argument, why bother with R for Mac at all?

Those of us who have colleagues on Windows with whom we need to 
exchange Powerpoint slides are just in a bind, is all.  But the 
bitmap() solution should work fine for me, now that I know about it!  
(I have not yet played with it to check).
Terrific!  Fantastic!  From a quick test, this works well.

So to sum up: the bitmap() solution was always there, had I not been 
too lazy to figure it out.  And now Simon has made an installer for 
pstoedit, which also works fine for me.   Two good solutions to my 
problem, one day after asking for them. That's what I call service!  I 
really appreciate this.
I have it and like it, but it's not a great solution for me: I 
frequently have to exchange slides with colleagues who use Powerpoint.  
  For a while I prepared my own talks in Keynote and exported to 
Powerpoint when I needed to, but there are some drawbacks and hassles 
associated with that.  More than half of my colleagues have switched to 
Mac now, but it will be hard to force a switch to Keynote as the de 
facto standard for everyone.  I do hope that in cases where I'm only 
dealing with my Mac-using colleagues, we can make Keynote the lingua 
franca.

Thanks again, Simon, for your help.

--Phil Price
#
I know this is not helpful for folks who don't have Illustrator, but 
as of today I got decent results using R's postscript() device to 
create an EPS file, opening it in Illustrator (v10), and exporting as 
WMF.

The image, then imported into either Word 2004 or PowerPoint 2004 was 
decent, in the single example I tried. Certainly much better than 
using R's pdf() and then importing directly into Word or PP.

Watch out for encoding issues; believe it or not, specifying 
encoding='WinAnsi' in postscript() may give the best results.

-Don
At 1:42 PM -0800 2/11/05, Phillip Price wrote:

  
    
#
Simon Urbanek wrote:
simon,

thanks for the hint (did not know of 'pstoedit').

but the binary provided by you did not run on my machine, exactly 
because 'gs' was _not_ in /usr/local/bin, but rather in /sw/bin (fink 
installation).

is there any way to adjust the search path used by pstoedit? if not so, 
for those with the same problem:

I reinstalled pstoedit via 'fink' from source and that worked out rather 
fine, knowing of the local path to 'gs' and everything.

regards,

joerg

ps: my test run gave satisfactory quality of the .emf output but it was 
a clipped (at the top) version of the pdf input. can that be prevented 
with one of the flags of pstoedit?
11 days later
#
hi everybody,

hope, this is not known, yet:
the package installer (R 1.01 (v1.01))ignores the "install at system 
level" button, at least if there is a ".Renviron" in the user's home 
directory (who installs the package). instead, the first entry of 
"R_LIBS" is used as target directory.

a bug, probably?

best regards,

joerg
#
hi,

I checked this more precisely: the reason seems to be not the
presence of '.Renviron' in the home dir, but rather the presence of
$R_LIBS in the environment (whereever defined). nevertheless: if the GUI
states that it's going to install in R.framework and then does'nt (even 
if it is my problem that I have defined R_LIBS in the first place) I 
would think this is not desirable behaviour.

regards,
joerg

==========================================
ORIGINAL MESSAGE:
==========================================
hope, this is not known, yet:
the package installer (R 1.01 (v1.01))ignores the "install at system
level" button, at least if there is a ".Renviron" in the user's home
directory (who installs the package). instead, the first entry of
"R_LIBS" is used as target directory.

a bug, probably?

best regards,

joerg