Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.61.0504281215590.32247@gannet.stats>
Date: 2005-04-28T11:24:51Z
From: Brian Ripley
Subject: Selecting font sizes graphics device
In-Reply-To: <BAA35444B19AD940997ED02A6996AAE001AF8E46@sanmail.picr.man.ac.uk>

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