[R-SIG-Mac] Problems with savePlot() and postscript under Snow Leopard
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Feb 15 09:47:25 CET 2010
On Sat, 13 Feb 2010, David Winsemius wrote:
>
> On Feb 13, 2010, at 5:04 PM, David Winsemius wrote:
>
>>
>> On Feb 13, 2010, at 4:08 PM, Hannes Nietnagel wrote:
>>
>>> Thanks David for your reply!
>>>
>>>
>>>> species.n <- as.numeric(iris$Species)
>>>> png("test.png")
>>>> plot(iris, col = species.n)
>>>> dev.off()
>>>
>>> That works fine for the png. But I still get the message:
>>> postscript
>>> 3
>>>
>>> What does it mean? Is there something wrong with my postscript?
>>
>> I think it is telling you which graohics device is open for plotting.
>>
>>> I still cannot produce a decent .eps file.
>>>
>>
>> From a fresh R session:
>>
>>> ?quartz
>> starting httpd help server ... done
>>> ?postscript
>>> species.n <- as.numeric(iris$Species)
>>> png("test.png")
>>> plot(iris, col = species.n)
>>> dev.off()
>> null device
>> 1
>>> postscript("test.eps")
>>> plot(iris, col = species.n)
>>> dev.off()
>> null device
>> 1
>>
>> I now have two files in my working directory (albeit with different aspect
>> ratios). The test.eps file can be read by Preview although it needs to be
>> converted to pdf to be displayed, and then appears perfectly normal to me.
>> The help page for postscript() says that single plots are eps by default,
>> so I just named it to correspond to htat promise. If you post the console
>> message and describe more fully what you mean by "cannot produce a decent
>> .eps file", someone might be able to comment more fully.
>
> One the other hand, efforts to insert that file into an OpenOffice.org
> presentation file results in an error: "Unknown graohic format". However,
> adding 2 out of 3 of the recommended arguments does result in a file that can
> be inserted. I'm not sure what is wrong either with the three argument effort
> (see below) or just using the "file=" argument approach.
>
>> postscript(file="test.eps",horizontal = FALSE, onefile = FALSE)
>> plot(iris, col = species.n)
>> dev.off()
> null device
> 1
>
> When I try with all three arguments I get an error:
>
>> postscript(file="test.eps",horizontal = FALSE, onefile = FALSE, paper =
>> "special")
>> plot(iris, col = species.n)
> Error in plot.new() : figure margins too large
You did not specify the size of the 'special' paper: use width=,
height=.
If you just use file= you
1) may get a rotated plot (and will if the factory-fresh default for
horizontal= is in place).
2) get a header that does not declare this is EPS, and some including
applications will fail to include it (properly or at all).
3) get a plot with margins on the default paper size (A4 or US
letter), which is not what one wants for inclusion.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-SIG-Mac
mailing list