[R] y label after axis (4)

Ko-Kang Kevin Wang kwan022 at stat.auckland.ac.nz
Fri Nov 7 20:52:33 CET 2003


On Fri, 7 Nov 2003, umeno wrote:

> Then, I want to label the second y axis "pay2".  I tried "title(ylab="pay2")", 
> but it put this lable on the first y-axis.  Does anyone know how to move this 
> to the second y-axis?

?mtext will do what you want.

For example, here is a few codes from Venables and Ripley 2002 "Modern 
Applied Statistics with S", Chapter 8.1:
  # alter margin 4; others are default
  oldpar <- par(mar = c(5.1, 4.1, 4.1, 4.1))
  plot(Days, Weight, type = "p", ylab = "Weight (kg)")
  Wt.lbs <- pretty(range(Weight*2.205))
  axis(side = 4, at = Wt.lbs/2.205, lab = Wt.lbs, srt = 90)
  mtext("Weight (lb)", side = 4, line = 3)
  par(oldpar) # restore settings

Note that you can also get the above codes from 



Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
    x88475 (City)
    x88480 (Tamaki)

More information about the R-help mailing list