[R] a high-level command for drawing a multiple series graph with each series having a label

hadley wickham h.wickham at gmail.com
Sat Jun 21 16:53:07 CEST 2008


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/



More information about the R-help mailing list