[R-SIG-Mac] tiff output on Mac

Simon Urbanek simon.urbanek at r-project.org
Fri Oct 16 20:43:50 CEST 2009


On Oct 16, 2009, at 1:24 PM, Sundar Dorai-Raj wrote:

> Ah, I see. It's not available when using R in Emacs, as I do:
>
>> args(quartz.save)
> Error in args(quartz.save) : object 'quartz.save' not found
>

No, it's only available in the R.app. However, you could adapt it to  
your use -- the code is available at
https://svn.r-project.org/R-packages/trunk/Mac-GUI/GUI-tools.R

Cheers,
Simon


> Thanks for the clarification.
>
> --sundar
>
> On Fri, Oct 16, 2009 at 10:20 AM, Simon Urbanek
> <simon.urbanek at r-project.org> wrote:
>>
>> On Oct 16, 2009, at 1:10 PM, Sundar Dorai-Raj wrote:
>>
>>> Hi, Simon,
>>>
>>> I'm not sure where quartz.save is? Can you send me a pointer?
>>>
>>
>> It's a function supplied by the R.app GUI. There is no help for it  
>> since
>> it's not part of any package.
>>
>>> args(quartz.save)
>> function (file, type = "png", device = dev.cur(), dpi = 100, ...)
>>
>> It's essentially a front-end to quartz() that is smart enough to  
>> find out
>> settings from the current device so it can replicate the result  
>> using any
>> quartz back-end. For parameters (except for "device" which is the  
>> device you
>> want to save from) see ?quartz.
>>
>> Cheers,
>> Simon
>>
>>
>>
>>>> help.search("quartz.save")
>>>
>>> No help files found with alias or concept or title matching
>>> ‘quartz.save’ using regular expression matching.
>>>>
>>>> R.version
>>>
>>>              _
>>> platform       i386-apple-darwin8.11.1
>>> arch           i386
>>> os             darwin8.11.1
>>> system         i386, darwin8.11.1
>>> status
>>> major          2
>>> minor          9.2
>>> year           2009
>>> month          08
>>> day            24
>>> svn rev        49384
>>> language       R
>>> version.string R version 2.9.2 (2009-08-24)
>>>
>>> Thanks,
>>>
>>> --sundar
>>>
>>> On Thu, Oct 15, 2009 at 2:54 PM, Simon Urbanek
>>> <simon.urbanek at r-project.org> wrote:
>>>>
>>>> On Oct 15, 2009, at 13:08 , Michael Denslow wrote:
>>>>
>>>>> Dear R Mac folks,
>>>>>
>>>>> I have not seen a thread on this so I thought I would get some  
>>>>> input
>>>>> regarding tiff output on a Mac.
>>>>> I am currently running OS 10.6.1 and R 2.9.2 GUI 1.29 Tiger  
>>>>> build 32-bit
>>>>> (5464).
>>>>>
>>>>> I realize that the easiest way to save a plot is to select File,  
>>>>> Save
>>>>> As. Which outputs a .pdf file. However, if I insert this graphic  
>>>>> into
>>>>> Microsoft Word and send it to a friend on Windows the file gets
>>>>> mangled (the quality is decreased significantly). So I am  
>>>>> working on
>>>>> just writing high quality tiff files which seem to display well  
>>>>> all on
>>>>> both platforms. Tiffs also seems to be one of the preferred file  
>>>>> types
>>>>> for many journals in my field.
>>>>>
>>>>
>>>> PNG is the format of choice these days and better supported in  
>>>> general.
>>>> TIFF
>>>> is more rare, but there is some support.
>>>>
>>>> If you want 1:1 result of what you see in the Quartz window then  
>>>> the best
>>>> way is to use quartz.save() as it maintains sizes to produce  
>>>> WYSIWYG
>>>> results, e.g:
>>>>
>>>> quartz.save("foo.tif","tiff",dpi=600)
>>>>
>>>> Cheers,
>>>> Simon
>>>>
>>>>
>>>>> Here are the options I have found that work on Macs.
>>>>>
>>>>>
>>>>> # requires Ghostscript
>>>>> bitmap(file="MacTest.tiff", type = "tifflzw",
>>>>>       height = 7, width = 7, res = 600,
>>>>>    units = "in")
>>>>> plot(rpois(1:40,10))
>>>>> dev.off()
>>>>>
>>>>>
>>>>> tiff('Mactest.tiff', width = 5, height = 5, units = 'in', res =  
>>>>> 600)
>>>>> plot(rpois(1:100,1))
>>>>> dev.off()
>>>>>
>>>>> quartz(height = 7, width = 7, type = 'tiff', file =  
>>>>> 'MacTest.tiff',bg
>>>>> = 'white',dpi = 600)
>>>>> hist(rpois(1:100,1))
>>>>> dev.off()
>>>>>
>>>>>
>>>>> hist(rpois(1:100,1))
>>>>> # line are not all dark in output, not sure which tiff type to  
>>>>> use...
>>>>> dev2bitmap(file = 'MacTest.tiff', type = 'tiff24nc', height = 7,  
>>>>> width
>>>>> = 7, res = 600,
>>>>>       units = 'in')
>>>>>
>>>>>
>>>>> I have noticed that for bitmap and tiff the font and symbol size  
>>>>> seems
>>>>> to differ between the R session plot and the output plot.
>>>>> Are there other graphic output options that I am missing here? Any
>>>>> tips would be most appreciated.
>>>>> Thanks in advance,
>>>>> Michael
>>>>>
>>>>> --
>>>>> Michael Denslow
>>>>>
>>>>> Graduate Student
>>>>> I.W. Carpenter Jr. Herbarium [BOON]
>>>>> Department of Biology
>>>>> Appalachian State University
>>>>> Boone, North Carolina U.S.A.
>>>>>
>>>>> -- AND --
>>>>>
>>>>> Communications Manager
>>>>> Southeast Regional Network of Expertise and Collections
>>>>> sernec.org
>>>>>
>>>>> _______________________________________________
>>>>> R-SIG-Mac mailing list
>>>>> R-SIG-Mac at stat.math.ethz.ch
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> 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