[R-SIG-Mac] quartz.save and tilde

Simon Urbanek simon.urbanek at r-project.org
Wed May 2 15:56:04 CEST 2007

On May 2, 2007, at 2:37 AM, hadley wickham wrote:

> On 5/1/07, Simon Urbanek <simon.urbanek at r-project.org> wrote:
>> DEnis,
>> On May 1, 2007, at 4:04 PM, Chabot Denis wrote:
>> > Until now, I've been able to use the tilde to replace "/Users/
>> > chabotd" in all my R scripts, be it directly or with the use of
>> > "paste".
>> >
>> > I am experimenting with quartz.save to produce png files to save
>> > the step of producing pdf and transforming them into png later. I
>> > need png to reduce file size for a series plots with thousands of
>> > points, even though I prefer vector drawings for most situations.
>> >
>> > I have not been able to find any documentation on quartz.save, but
>> > if I include the tilde in the file name, something that works with
>> > pdf or png devices, it does not work (for me) with quartz.save. I
>> > need to give the unabridged path.
>> >
>> > Is there a reason for this?
>> >
>> Yes, the tilde is not expanded. Why is it not expanded? Because the
>> author didn't think of it ;). It's fixed now.
>> > Also, what are the options in quartz.save? I've only managed to use
>> > file="path and file"  and type="png" or type="pdf". I've tried to
>> > control resolution (res=300) but it had no effect, so for now I
>> > change the size of the quartz graphics when I call quartz (which
>> > forces me to change pointsize as well to keep proportions of text
>> > relative to drawing size the same.
>> >
>> file, type and device are the only options of quartz.save and the
>> purpose is to save the image "as-is", directly from the Quartz
>> window, so res doesn't make sense here (it would no longer be a
>> direct snapshot of the window). I guess it would be possible to do
>> what you described, though (Quartz->PDF->PNG of any resolution). I'll
>> see if there is an easy way to do that ...
> 2005/3/4/+pdf2png&hl=en&ct=clnk&cd=3&client=safari
> might give you some ideas

It does basically the same as quartz.save(type="png") - you get a 1:1  
result with the screen resolution. What Denis suggested is a control  
over the dpi of the png so that you can create a png that is actually  
far bigger than the window itself and yet WYSIWYG. This is not as  
easy, because the Quartz PNG dump works by using the screen  
resolution, so we need some off-screen PDF rendering to an  
arbitrarily sized PNG ...

> - having a native quartz png output device would be fantastic.

We have that already ;).


More information about the R-SIG-Mac mailing list