On Wed, May 28, 2008 at 04:15:34PM -0500, Ben Fairbank wrote: > > I would like to use plot() to plot two cumulative distribution curves so > that a user of the plot can compare the distributions of the two > variables. The following code draws two distributions separately, but I > cannot find the instruction necessary to add a second cumulative > distribution to the first one.
> x1 <- sort(rnorm(1000,50,10)) > x2 <- sort(rnorm(1000,40,8)) > > plot(x1,1:length(x1)/length(x1),type="l") > plot(x2,1:length(x2)/length(x2),type="l") To add a line to an existing plot use lines() instead of plot(): lines(x2,1:length(x2)/length(x2)) In case you want to add points use points(). cu Philipp -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihenstephan 85350 Freising, Germany and Institut für Bioinformatik und Systembiologie / MIPS Helmholtz Zentrum München - Deutsches Forschungszentrum für Gesundheit und Umwelt Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel ______________________________________________ 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.