[R] Can plot() be used for multiple plots?

From: Ben Fairbank <BEN_at_ssanet.com>
Date: Wed, 28 May 2008 16:15:34 -0500


Greetings helpRs --  

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.  

Any suggestion would be very welcome.  

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")

grid(col = "black")  

Ben Fairbank  

        [[alternative HTML version deleted]]



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 Wed 28 May 2008 - 21:20:02 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 29 May 2008 - 01:30:49 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