[R] Secondary axis

Patrick Martin pma.sts at sea.noc.soton.ac.uk
Mon Aug 6 02:59:39 CEST 2007

Dear R help list members,

I am trying to plot two sets of data (both of which are zoo objects)  
in the same graph using two separate y-axes with different scales,  
with the x-axis consisting of dates. I have simply used a plot()  
command to plot first one set of data, and then added the second set  
with lines(). I have also tried to add a further y-axis (at side=4),  
but this simply comes up with the same scale as the first y-axis. I  
somehow need to 'associate' one of the data sets with the second y- 
axis, such that it will scale sensibly (my first data set ranges from  
0-25, the second one from 0 to 40). The problem is compounded by the  
fact that the two data sets have very different frequencies: one  
consists of twice-monthly measurements, the other of hourly  
measurements. I would be very grateful for advice on how to do this.

Thanks in advance,
Patrick Martin

More information about the R-help mailing list