Font size of axis labels

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Font size of axis labels

Hilmar Berger-3
Hi all,

In R, it is not possible to set the font size of axis labels directly
(AFAIK). Instead, scaling factors for the font chosen by the graphics
device can be supplied. It appears that there is no constant font size
for axis labels. My impression is that the axis label font size is
scaled internally by R depending on the number of labels given for an axis.

In addition to the R-internal scaling  I need to adjust the axis label
font size for label length and the size of other elements in the same
layout.

In order to use sensitive values for those externally supplied scaling
factors (cex) I would like to know how R scales axis font sizes internally.
Could someone point me to the method/file in the R-source code (R 2.1.1)
where this scaling is done ?

Thanks,
Hilmar
--

Hilmar Berger
Studienkoordinator
Institut für medizinische Informatik, Statistik und Epidemiologie
Universität Leipzig
Härtelstr. 16-18
D-04107 Leipzig

Tel. +49 341 97 16 101
Fax. +49 341 97 16 109
email: [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Font size of axis labels

Prof Brian Ripley
On Tue, 17 Jan 2006, Hilmar Berger wrote:

> In R, it is not possible to set the font size of axis labels directly
> (AFAIK).

Nor of anything else, since you are limited to the fonts available on the
output device.

> Instead, scaling factors for the font chosen by the graphics
> device can be supplied. It appears that there is no constant font size
> for axis labels. My impression is that the axis label font size is
> scaled internally by R depending on the number of labels given for an axis.

Please can we have a demonstration of this: I have never seen it.

> In addition to the R-internal scaling  I need to adjust the axis label
> font size for label length and the size of other elements in the same
> layout.
>
> In order to use sensitive values for those externally supplied scaling
> factors (cex) I would like to know how R scales axis font sizes internally.
> Could someone point me to the method/file in the R-source code (R 2.1.1)
> where this scaling is done ?

I don't believe there is any scaling.  And 2.1.1 is not current.

The code used is in do_axis in src/main/plot.c.  The font size is selected
at

     Rf_gpptr(dd)->cex = Rf_gpptr(dd)->cexbase * Rf_gpptr(dd)->cexaxis;

that is, just the base 'cex' multiplied by 'cex.axis' (as documented in
?axis in current R).  So the target font size is

'pointsize' * 'cex' * 'cex.axis'

where the first term is set by the specific device, the second by
par("cex") and the third either via par("cex.axis") or inline from the
axis() call.  Devices will produce a nearby font size in a
device-dependent fashion (both the postscript/PDF and windows families of
devices round to the nearest big point: the story for X11 is much more
complicated).

--
Brian D. Ripley,                  [hidden email]
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html