[R] Secondary axis

jim holtman jholtman at gmail.com
Mon Aug 6 12:53:07 CEST 2007


plot(....)
par(new=TRUE)
plot(...)
axis(4,...)

On 8/5/07, Patrick Martin <pma.sts at sea.noc.soton.ac.uk> wrote:
> 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
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list