[R-SIG-Mac] Difficulties with quartz() device and clipboard?
Simon Urbanek
simon.urbanek at r-project.org
Thu Oct 23 15:37:59 CEST 2008
Bob,
On Oct 22, 2008, at 19:23 , Robert Chatfield wrote:
> Thanks, Steve; this works. albeit in a new way. Some notes for the
> user follow.
>
> Simple-documentation copy-paste:
> I must start the device this way to avoid difficulties (see quartz())
> quartz(bg="white")
>
> Then I may copy and open up the file in Preview;
> from there, I may copy again and paste into Word or into
> Graphicconverter. (These probably accepted picts earlier, from
> what I could infer from the FAQ).
>
> If one does not set the background, then the Preview version looks
> fine, but the image pasted elsewhere has black lettering (usually)
> on a black background.
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.
> Hence quartz(bg="white")
>
> Higher quality pdf's:
> I assume I should do a quartz.save to get a high quality image
> if I think that the image may head to publication.
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.
> When I do this, the image opens correctly in Preview, but it appears
> that some images (a filled-contour color field overlaid by labelled
> contours in plot4d.r) do not display correctly in my old Adobe
> application (a second whiting out, maybe?.
Can you, please, share with use the code to reproduce this so we can
check it?
Thanks,
Simon
>
> If I do not set bg="white" then both are drawn correctly from the
> quartz.save()
> version.
>
> regards, Bob
>
> On Oct 22, 2008, at 3:46 PM, Steve Revilak wrote:
>
>>> Date: Wed, 22 Oct 2008 14:41:07 -0700
>>> From: Robert Chatfield <Robert.B.Chatfield at nasa.gov>
>>> To: r-sig-mac at stat.math.ethz.ch
>>> Subject: [R-SIG-Mac] Difficulties with quartz() device and
>>> clipboard?
>>> I have difficulties with the R-GUI or the R Quartz Window,
>>>
>>> At one time it was easy to copy to the clipboard and then paste into
>>> another document, e.g. Microsoft Word or GraphicConverter or ...
>>> No more. There is a "Copy" item available (in dark letters, not
>>> greyed)
>>> in the Edit menu, but nothing goes into clipboard. I can verify this
>>> with
>>> several applications that have a "Show Clipboard" menu item.
>>> This was great for recording results of exploratory sessions without
>>> a generating a large number of files.
>>
>> 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?
>>
>>
>>> Items saved by quartz.save do not seem to open correctly in Preview
>>> or Acrobat. I assume that one must close the Quartz device with
>>> dev.off() Maybe I just need an example of quartz.save in action.)
>>
>> 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
>
> Dr. Robert Chatfield
> Earth Sciences, MS 245-5
> NASA Ames Research Center
> Moffett Field, CA 94035 USA
>
> Ph: 650-604-5490 FAX 650-604-3625
>
> http://geo.arc.nasa.gov/sgg/chatfield
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>
More information about the R-SIG-Mac
mailing list