[R] Changing expression font

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 16 22:32:26 CEST 2006


You have not told us the device you are using, nor your version of R.

The way to select 'Times New Roman' is via the family, which will work if 
it is supported on the device and your R is current (2.3.0, preferably 
patched).

font=6 is only supported on a few devices, and not on X11 on Linux.
There you can choose Times via options("X11Fonts").

For example,

pdf(family="Times")
plot(x=my.df[,1], y=my.df[,2],
      xlab=expression(paste("Independent(",mu,"g/L)")),
      ylab=expression(paste("Dependent (",mu,"g/L)")))

works (on FC3 and Windows).

On Tue, 16 May 2006, Scott Rollins wrote:

> I'm trying to label axes using 'expression', but I would also like to 
> change the font to Times New Roman (a requirement of the journal). I'd 
> appreciate any advice.
>
> Here's one example of several things that I've tried, including changes 
> to par() parameters 'family', 'font', 'font.axis', and 'font.lab', which 
> are not shown below.
>
> x <- 1:10
> z <- rnorm(10,0,3)
> y <- x + z
> my.df <- data.frame(x,y)
> # example where font formatting works in Windows XP (but does not in FC3)
> plot(x=my.df[,1], y=my.df[,2], xlab="Independent", ylab="Dependent", font.axis=6, font.lab=6)
> # example using 'expression' where label fonts are not changed
> plot(x=my.df[,1], y=my.df[,2], xlab=expression(paste("Independent  (",mu,"g/L)")), ylab=expression(paste("Dependent (",mu,"g/L)")), font.axis=6, font.lab=6)
>
> Thanks,
> Scott
>
>
> __________________________________________________
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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