Re: [R] plot y1 and y2 on one graph
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@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.
[R] plot y1 and y2 on one graph
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). Any help are welcome. Kind regards Miltinho Brazil [[alternative HTML version deleted]] __ R-help@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.
Re: [R] plot y1 and y2 on one graph
This should do what you want: x-1:10 y1-x+runif(10)*2 y2-seq(0,50,length.out=10)+rnorm(10)*10 plot(y1~x, bty='c') par(new=TRUE) # plot on the same graph plot(y2~x, col='red', axes=FALSE, bty='c', xlab='', ylab='') axis(4, col.axis='red', col='red') mtext(y2, 4, col='red', line=-2) On Wed, Feb 27, 2008 at 5:05 PM, milton ruser [EMAIL PROTECTED] 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). Any help are welcome. Kind regards Miltinho Brazil [[alternative HTML version deleted]] __ R-help@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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? Tell me what you want to do, not how you want to do it. __ R-help@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.
Re: [R] plot y1 and y2 on one graph
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). Before you actually do that, you might want to think about if it's a good idea or not. Are you trying to deliberately mislead or confuse your readers? If so, it's a good idea, otherwise it's probably not. You might want to read this blast from the past: K. W. Haemer. Double scales are dangerous. The American Statistician, 2(3):24–24, 1948. Hadley -- http://had.co.nz/ __ R-help@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.
Re: [R] plot y1 and y2 on one graph
There is an example in library(zoo) example(plot.zoo) On Wed, Feb 27, 2008 at 5:05 PM, milton ruser [EMAIL PROTECTED] 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). Any help are welcome. Kind regards Miltinho Brazil [[alternative HTML version deleted]] __ R-help@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. __ R-help@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.
Re: [R] plot y1 and y2 on one graph
Thanks to all, I reached up to my needs. miltinho Brazil. On 2/27/08, Gabor Grothendieck [EMAIL PROTECTED] wrote: There is an example in library(zoo) example(plot.zoo) On Wed, Feb 27, 2008 at 5:05 PM, milton ruser [EMAIL PROTECTED] 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). Any help are welcome. Kind regards Miltinho Brazil [[alternative HTML version deleted]] __ R-help@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. [[alternative HTML version deleted]] __ R-help@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.