Skip to content

Difficulties with quartz() device and clipboard?

4 messages · Steve Revilak, Robert Chatfield, Simon Urbanek

#
This might have something to do with what Word is willing to accept.
With Mac OS 10.5.5, R 2.7.2, GUI 1.25 (5217), I can say

   plot(1:10, 1:10, type="l")

R opens a quartz window and displays the line plot.  From there I can
copy the plot to the clipboard (via Cmd-C or Edit > Copy); after the
copy, I'll switch to Preview.app and press Cmd-N ("New from
clipboard") within Preview; Preview creates a new pdf document with
the plot.

Perhaps word doesn't handle pasting of pdf data?
plot(1:10, 1:10, type="l")
   quartz.save("foo.png");
   quartz.save("foo.pdf", type="pdf");

After running these three commands, you should have a pdf named
"foo.pdf" and a png named "foo.png".

HTH.

Steve
#
Bob,
On Oct 22, 2008, at 19:23 , Robert Chatfield wrote:

            
That is likely a bug in whatever program you're pasting it in as it  
doesn't handle transparency properly (by default the plot is painted  
on a transparent background so it's easier to adapt it to your style  
in Keynote etc.). I was checking with Adobe CS2 and it works without  
problems, so I suspect your application is simply too old to handle  
that. You don't need to use Preview, you can paste straight from  
Quartz without problems.
There is no such thing as "higher quality PDFs". All PDFs contain the  
plot as-is (whether you use copy/paste, quartz PDF output or pdf  
device). What you probably mean is high quality PNG (bitmap) images.  
Those can be created with quartz.save by specifying the target  
resolution such as:
quartz.save("foo.png",dpi=300)
However, that is not what you want to use for publications.

Note that MS products cannot handle PDF (definitely not on the Windows  
side), so you cannot use PDF there (which is really stupid, but that's  
another story). That's why you may prefer higher-resolution PNG if the  
document is to be shared with Windows people.
Can you, please, share with use the code to reproduce this so we can  
check it?

Thanks,
Simon