I am a new user of R. Please does somebody knows how to plot 3 datasets (x1,a1),...,(xn,an), (x1,b1),...,(xn,bn), and (x1,c1),...,(xn,cn) on a single x,y plot, each of the three datasets being plotted with its own character pch() ? (three calls to plot() erase the two first datasets). Thank you very much. Michel Petitjean, DSV/iBiTec-S/SB2SM (CNRS URA 2096), CEA Saclay, bat. 528, 91191 Gif-sur-Yvette Cedex, France. Phone: +331 6908 4006 / Fax: +331 6908 4007 E-mail: michel.petitjean at cea.fr http://petitjeanmichel.free.fr/itoweb.petitjean.html
Michel PETITJEAN-2 wrote:> > I am a new user of R. > Please does somebody knows how to plot 3 datasets > (x1,a1),...,(xn,an), (x1,b1),...,(xn,bn), and (x1,c1),...,(xn,cn) > on a single x,y plot, each of the three datasets being plotted with > its own character pch() ? > (three calls to plot() erase the two first datasets). > Thank you very much. > Hi Michel, > Have you check ?plot. You could plot 1st data set then plot (2nd data set, > lty="b", add=TRUE) and then plot (3rd data set, lty="b", add=TRUE) then > you could get what you want. I believe. > > Hope it helps > Chunhao > > > Michel Petitjean, > DSV/iBiTec-S/SB2SM (CNRS URA 2096), CEA Saclay, bat. 528, > 91191 Gif-sur-Yvette Cedex, France. > Phone: +331 6908 4006 / Fax: +331 6908 4007 > E-mail: michel.petitjean at cea.fr > http://petitjeanmichel.free.fr/itoweb.petitjean.html > > ______________________________________________ > 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. > >-- View this message in context: http://www.nabble.com/3-curves---1-plot-tp19784236p19784604.html Sent from the R help mailing list archive at Nabble.com.
example(matplot) or ?points On Thu, Oct 2, 2008 at 11:43 AM, Michel PETITJEAN <michel.petitjean at cea.fr> wrote:> I am a new user of R. > Please does somebody knows how to plot 3 datasets > (x1,a1),...,(xn,an), (x1,b1),...,(xn,bn), and (x1,c1),...,(xn,cn) > on a single x,y plot, each of the three datasets being plotted with > its own character pch() ? > (three calls to plot() erase the two first datasets). > Thank you very much. > > Michel Petitjean, > DSV/iBiTec-S/SB2SM (CNRS URA 2096), CEA Saclay, bat. 528, > 91191 Gif-sur-Yvette Cedex, France. > Phone: +331 6908 4006 / Fax: +331 6908 4007 > E-mail: michel.petitjean at cea.fr > http://petitjeanmichel.free.fr/itoweb.petitjean.html > > ______________________________________________ > 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. >
imho better: ?xyplot using the groups argument. -- Bert -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Kingsford Jones Sent: Thursday, October 02, 2008 11:17 AM To: Michel PETITJEAN Cc: r-help at r-project.org Subject: Re: [R] 3 curves / 1 plot example(matplot) or ?points On Thu, Oct 2, 2008 at 11:43 AM, Michel PETITJEAN <michel.petitjean at cea.fr> wrote:> I am a new user of R. > Please does somebody knows how to plot 3 datasets > (x1,a1),...,(xn,an), (x1,b1),...,(xn,bn), and (x1,c1),...,(xn,cn) > on a single x,y plot, each of the three datasets being plotted with > its own character pch() ? > (three calls to plot() erase the two first datasets). > Thank you very much. > > Michel Petitjean, > DSV/iBiTec-S/SB2SM (CNRS URA 2096), CEA Saclay, bat. 528, > 91191 Gif-sur-Yvette Cedex, France. > Phone: +331 6908 4006 / Fax: +331 6908 4007 > E-mail: michel.petitjean at cea.fr > http://petitjeanmichel.free.fr/itoweb.petitjean.html > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. >______________________________________________ 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.
You can use the points() and lines() functions to add points and lines to an existing plot. Julian Michel PETITJEAN wrote:> I am a new user of R. > Please does somebody knows how to plot 3 datasets > (x1,a1),...,(xn,an), (x1,b1),...,(xn,bn), and (x1,c1),...,(xn,cn) > on a single x,y plot, each of the three datasets being plotted with > its own character pch() ? > (three calls to plot() erase the two first datasets). > Thank you very much. > > Michel Petitjean, > DSV/iBiTec-S/SB2SM (CNRS URA 2096), CEA Saclay, bat. 528, > 91191 Gif-sur-Yvette Cedex, France. > Phone: +331 6908 4006 / Fax: +331 6908 4007 > E-mail: michel.petitjean at cea.fr > http://petitjeanmichel.free.fr/itoweb.petitjean.html > > ______________________________________________ > 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.