[R] qplot

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Feb 19 13:34:24 CET 2008


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 op 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 op r-project.org [mailto:r-help-bounces op 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 op 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.



More information about the R-help mailing list