[R] Two Y-axises and One X-axis

Ko-Kang Kevin Wang kwan022 at stat.auckland.ac.nz
Fri Nov 7 19:21:04 CET 2003


Hi,

On Fri, 7 Nov 2003, umeno wrote:

> I would like to know if anyone knows how to draw a plot with two Y-axises and 
> one X-axis? When you have two sets of y values that do not have the same 
> scale, but correspond to the same x value, I would like to plot them on one 
> graph.

I think both "Modern Applied Statistics with S" (Venables and Ripley 2002) 
and "Introductory Statistics with R" (Dalgaard 2002) have some example.

Basically one way to do this is to build the plot "piece by piece" (aka by 
first principle, or low-level plotting).  For example, the axis() command 
can be useful:
  axis(1) # x-axis at the bottom
  axis(2) # y-axis on the left
  axis(4) # y-axis on the right


-- 
Cheers,

Kevin

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