From ripley at stats.ox.ac.uk  Tue Dec 11 11:30:12 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 11 Dec 2007 10:30:12 +0000 (GMT)
Subject: [Rd] Defaults for postscript()
In-Reply-To: <eb555e660712060032v46ce904clf1e454394b59e943@mail.gmail.com>
References: <Pine.LNX.4.64.0712060752060.17952@gannet.stats.ox.ac.uk>
	<eb555e660712060032v46ce904clf1e454394b59e943@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0712101212001.13534@gannet.stats.ox.ac.uk>

I think everyone who commented has overlooked that the defaults for these 
postscript() arguments are set by ps.options(), so in fact we are talking 
about the defaults for the defaults.  Unfortunately, the documentation on 
this was full of errors, including not pointing out that some of the 
ps.options() settings apply to xfig() and pdf() (and some do not).
In fact, although you can set the default for 'onefile' via ps.options(), 
that setting is never used AFAICS.

This means that it was never completely safe to rely on the defaults in 
test scripts in packages, since a site could change these defaults 
(although hopefully it would have been done in a file skipped by 
--vanilla).

Given that (most of) the defaults are customizable, it does seem to me to 
be much more important to have defaults that are appropriate to the naive 
user and not the expert one.  When I first drafted this, I thought one 
could switch between the old and proposed defaults via a call to 
ps.options(), but despite documenting 'onefile' as an argument, it is 
never actually used.

I had a further follow-up suggestion, which is to change the default 
device in non-interactive use from postscript() to pdf().  I believe that 
PDF viewers are more widely available than PS viewers these days (almost 
every Windows box ships with AcroRead, and Mac OS has native PDF viewers). 
There used to be an argument over the non-availability of Free PDF viewers 
and the limited range of platforms supported by AcroRead, but the 
availability of several viewers based on xpdf seem to satisfy that 
argument at least as well as the availability of ghostscript and 
front-ends do for PS (and GSView, the Windows front-end, is shareware-like 
- I keep forgetting that, as Oxford has a site licence).

I remain convinced that producing rotated PS plots of a size (and aspect 
ratio) that depends on the locale (since the default papersize does) is no 
longer a reasonable default.

That leaves onefile=TRUE.  Even if we don't move the non-interactive 
default device to pdf, it could be postscript(onefile=TRUE).  However, it 
ought to be possible to implement onefile=NA, which would write an EPS 
file if only one plot was produced and a multi-page PS file otherwise.
That would seem to me to be a good compromise.

Comment to Marc Schwartz: we can't force a Notes sections above Details, 
as the ordering of sections is dictated by Rdconv.  I had already done 
some re-structuring of the page, moving printing to a new section.

A further comment: I wonder if we really want this complexity of using 
ps.options() to set default defaults: I am inclined to remove it for xfig 
and pdf.  (Given that it was not documented, it is unlikely anyone is
knowingly used it.)


On Thu, 6 Dec 2007, Deepayan Sarkar wrote:

> On 12/6/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
>> The defaults for postscript()
>>
>> paper = "default"
>> onefile = TRUE
>> horizontal = TRUE
>>
>> (it seems) date from the days when people used to used this to send plots
>> directly to a postscript printer via print.it=TRUE.  I haven't done that
>> for years, and it seems that our current generation of students don't even
>> know the concept.  It seems 'horizontal = TRUE' is particularly difficult
>> to grasp.
>>
>> Given that I suspect almost all uses of postscript() are to produce plots
>> to be viewed on-screen or incorporated into another document, a more
>> appropriate set of defaults would be
>>
>> width = 7, height = 7
>> paper = "special"
>> onefile = FALSE
>> horizontal = FALSE
>>
>> which would have the advantage of using the same default aspect ratio for
>> plots as all (?) other R graphics devices.
>>
>> Does anyone see a reason not to change the defaults?
>
> I'm not so sure about the 'onefile' change. Scripts with multiple
> plots run in batch mode will end up with multiple files; I prefer the
> current behaviour. I also have test scripts in packages that go
>
>
> postscript("something.ps")
> <many examples>
> dev.off()
>
>
> Unless I change all these to have onefile=TRUE, I'll end up only with
> the last plot available after the tests are run.
>
> -Deepayan
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
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



[Rd] Defaults for postscript()
Prof Brian Ripley