[Rd] Using strwidth before plotting

Prof Brian D Ripley ripley@stats.ox.ac.uk
Wed, 17 Apr 2002 07:39:22 +0100 (BST)


On Tue, 16 Apr 2002, Duncan Murdoch wrote:

> In the plotcorr() function in the ellipse package, I want to position
> things differently depending on the size of the labels.  I can use
> strwidth to find out the length of the labels, but only when there's a
> plot window open:  it won't open one.
>
> Question:  What function call says:  make sure there's a window open
> (i.e. do what plot() does before it starts plotting)?

Call par(), e.g. par("font")

> I don't think I can use plot.new() or frame(), because I don' t want
> to leave a blank page in the plot history if there was already a
> window open.

(That is indeed what happens.)

You can find if there is a device open by looking at length(.Devices) > 1
or dev.cur() > 1.

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._