[R] Selecting font sizes graphics device

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 28 13:24:51 CEST 2005


On Thu, 28 Apr 2005, Crispin Miller wrote:

> Im' using matrix() and layout() to set up a fairly complex plot...
>
> I was wondering if anyone can point me to something that describes the
> appropriate incantations to determine, given a text string, the maximum
> font size that will allow it to fit into the current plotting area
> without being trunucated?

Well, this depends on the graphics device, and none allows you to choose 
the font size of a running window.  You can use cex, but its mapping to 
font sizes may well be piecewise constant.

So I think the best you can do in general is strwidth/height plus 
trial-and-error on its cex argument.  If you have a specific device in 
mind, you can find out the cex+ps -> font size mapping byt reading the 
code or experiment.

-- 
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-help mailing list