[R] Changing expression font

Paul Murrell p.murrell at auckland.ac.nz
Tue May 16 22:20:37 CEST 2006


Hi


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)


This works for me (Windows XP, R 2.2.1) ...

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

... (and this for R 2.3.0) ...

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


Paul
> __________________________________________________
> 
> 
> 
> 	[[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

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list