Mark Farnell
2008-Jun-21 06:00 UTC
[R] a high-level command for drawing a multiple series graph with each series having a label
I wish to draw a graph representing multiple series (sets of x,y points). Each series has its own label and points within each series are joined by a line ordered by their X cooridnate. I would also like a legend automatically showing which each series is. Which high-level command can serve this purpose? I looked at my book but can't find such a command. Thanks! Mark
John Kane
2008-Jun-21 14:37 UTC
[R] a high-level command for drawing a multiple series graph with each series having a label
?plot ?lines used together. Note you need to set type="l" in plot --- On Sat, 6/21/08, Mark Farnell <mark.farnell at gmail.com> wrote:> From: Mark Farnell <mark.farnell at gmail.com> > Subject: [R] a high-level command for drawing a multiple series graph with each series having a label > To: R-help at r-project.org > Received: Saturday, June 21, 2008, 2:00 AM > I wish to draw a graph representing multiple series (sets of > x,y > points). Each series has its own label and points within > each series > are joined by a line ordered by their X cooridnate. > > I would also like a legend automatically showing which each > series is. > > Which high-level command can serve this purpose? I looked > at my book > but can't find such a command. > > Thanks! > > Mark > > ______________________________________________ > 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.__________________________________________________________________ [[elided Yahoo spam]]
hadley wickham
2008-Jun-21 14:53 UTC
[R] a high-level command for drawing a multiple series graph with each series having a label
On Sat, Jun 21, 2008 at 1:00 AM, Mark Farnell <mark.farnell at gmail.com> wrote:> I wish to draw a graph representing multiple series (sets of x,y > points). Each series has its own label and points within each series > are joined by a line ordered by their X cooridnate. > > I would also like a legend automatically showing which each series is. > > Which high-level command can serve this purpose? I looked at my book > but can't find such a command.You can use ggplot2: install.packages("ggplot2") library(ggplot2) data(Oxboys, package = "nlme") qplot(age, height, data=Oxboys, colour = Subject, geom="line") Although you'll probably want fewer series for the legend to be useful! Hadley -- http://had.co.nz/