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