Re: [R] qplot

From: ONKELINX, Thierry <Thierry.ONKELINX_at_inbo.be>
Date: Tue, 19 Feb 2008 13:34:24 +0100

Format your dataframe into a long format. Then use a grouping variable to distinguish both lines.

library(ggplot2)
DF <- data.frame(X = rep(0:20, 2), Y = c(rnorm(21), runif(21)), Z = gl(2, 21))

ggplot(data = DF, aes(x = X, y = Y, colour = Z)) + geom_line()

HTH, Thierry

PS. I suggest you read the ggplot book at http://had.co.nz/ggplot2/book.pdf




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx_at_inbo.be
www.inbo.be

Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney

-----Oorspronkelijk bericht-----
Van: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] Namens sigalit mangut-leiba
Verzonden: dinsdag 19 februari 2008 13:16 Aan: r-help
Onderwerp: [R] qplot

Hello,
I have a question about "qplot": How can I add another line to the same plot ?
(like function "lines" in "plot").
Thank You,
Sigalit.

        [[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.

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 Tue 19 Feb 2008 - 12:35:48 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 Tue 19 Feb 2008 - 13:30:16 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