[Rd] Defaults for postscript()
Henrik Bengtsson
hb at stat.berkeley.edu
Fri Dec 7 06:08:40 CET 2007
On 06/12/2007, Marc Schwartz <marc_schwartz at comcast.net> wrote:
>
> On Thu, 2007-12-06 at 00:32 -0800, 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
>
> In a vacuum, I would agree that changing the default values makes sense
> given the preponderance of the use for postscript() for creating EPS
> files for use in LaTeX and other documents (eg. Office/OO.org). It might
> also serve to reduce the frequency of questions on the lists on this
> subject.
>
> That being said, I understand Deepayan's concern.
>
> I don't have a sense of how many others would be affected by such a
> change.
>
> Pending any other comments on the matter, an incremental approach might
> include an initial near term restructuring of the help file for
> postscript(), whereby the following content in the Details section:
>
>
> The postscript produced for a single R plot is EPS (Encapsulated
> PostScript) compatible, and can be included into other documents, e.g.,
> into LaTeX, using \includegraphics{<filename>}. For use in this way you
> will probably want to set horizontal = FALSE, onefile = FALSE, paper =
> "special". Note that the bounding box is for the device region: if you
> find the white space around the plot region excessive, reduce the
> margins of the figure region via par(mar=).
I would like to suggest the following wrapper:
eps <- function(file="Rplot%03d.eps", horizontal=FALSE, paper="special", ...) {
postscript(file=file, onefile=FALSE, horizontal=horizontal, paper=paper, ...);
}
That separates the use case of creating EPS files and "regular"
postscript files allow each of eps() and postscript() to have their
own default values.
/Henrik
>
>
> is moved to a new Notes section, which could precede the Details
> section, given the likely nature of such use. This change could be done
> now for R-patched and R-devel.
>
> A separate second comment could be added to the Notes section,
> indicating that the defaults will change to those above in version
> 2.8.0. The longer time frame would give affected package maintainers a
> heads up of the pending change and more lead time for implementation of
> any changes.
>
> HTH,
>
> Marc
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
More information about the R-devel
mailing list