[R] determing font type in expression

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jul 22 11:07:05 CEST 2008


On Tue, 22 Jul 2008, Thomas Hoffmann wrote:

> Dear R-Maillist members,
>
> I would like to label the y-axis of a plot with a mathematical expression 
> "sed.rate mm a-1", where the "-1" is printed subscript.

That's not a reproducible example.

> I am using font.lab=15 for the x-axis. However, when plotting the y-axis 
> with the expression-function it appears in a different font. Does 
> anybody knows how to use font.lab=15 in the expression as well?

Only the use of 'family' is portable -- we have no idea what font 15 is, 
and AFAIK it is specific to the windows() family of devices.  Plotmath 
will use the current family, e.g.

> plot(1:10, ylab=expression(y^-1), family="serif")

uses the serif font (normally Times).  So you should be able to set up a 
family to do this.

> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

PLEASE do, and supply the information asked for next time.

-- 
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