Re: [R] Changing expression font

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed 17 May 2006 - 06:32:26 EST

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

______________________________________________
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:39:04 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.