From hb at biostat.ucsf.edu  Sat Nov  5 23:08:48 2011
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Sat, 5 Nov 2011 15:08:48 -0700
Subject: [Rd] How to infer default width and height for a device?
Message-ID: <CAFDcVCRGOwoTe7KR1O4erRagTG0xwrrf2+SfrRV=WwW1W=YrDg@mail.gmail.com>

Hi.

GENERAL:
Is there a general method for inferring default device settings,
particularly 'width' and 'height', that works for all devices?  AFAIK,
the answer is no, but there might be functions out there that I don't
know of.


POSTSCRIPT SPECIFIC:
If not, I'm considering implementing such a method myself.  Is it
possible for R to infer the default 'width' and 'height' for the
*postscript* device, or is this defined outside of R?  I've noticed
that they are not defined by the arguments to postcript():

> args(grDevices::postscript)
function (file = ifelse(onefile, "Rplots.ps", "Rplot%03d.ps"),
    onefile, family, title, fonts, encoding, bg, fg, width, height,
    horizontal, pointsize, paper, pagecentre, print.it, command,
    colormodel, useKerning, fillOddEven)

and in the list of predefined device options they are zero:

> ps.options()[c("width", "height")]
$width
[1] 0
$height
[1] 0

and debugging postcript() they are indeed passed as zeros to
.External(PostScript, ...).


> sessionInfo()
R version 2.14.0 Patched (2011-11-03 r57560)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] R.utils_1.9.0     R.oo_1.8.3        R.methodsS3_1.2.1

loaded via a namespace (and not attached):
[1] tools_2.14.0

Thanks

Henrik



[Rd] How to infer default width and height for a device?
Henrik Bengtsson