Re: [R] plot y1 and y2 on one graph

From: Jim Lemon <jim_at_bitwrit.com.au>
Date: Thu, 28 Feb 2008 21:16:20 +1100

milton ruser wrote:
> Dear all
>
> I have a code like
>
> x<-1:10
> y1<-x+runif(10)*2
> y2<-seq(0,50,length.out=10)+rnorm(10)*10
>
> par(mfrow=c(1,2))
> plot(y1~x)
> plot(y2~x)
>
> Now I would like to plot y1 and y2 on the same graph, with its two scales
> (y1 on left and y2 on rigth side).
>
Hi Miltinho,
twoord.plot in the plotrix package might do the job for you.

twoord.plot(x,y1,x,y2)

Jim



R-help_at_r-project.org 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. Received on Thu 28 Feb 2008 - 10:14:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Feb 2008 - 10:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive