Re: [R] Changing expression font

From: Paul Murrell <p.murrell_at_auckland.ac.nz>
Date: Wed 17 May 2006 - 06:20:37 EST

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@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@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
R-help@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
Received on Wed May 17 06:24:38 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 17 May 2006 - 08:10:19 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.