Re: [R] Overplotting: plot() invocation looks ugly ... suggestions?

From: hadley wickham <>
Date: Wed 26 Jul 2006 - 17:54:17 EST

> And if lattice is ok then try this:
> library(lattice)
> xyplot(Consumption ~ Quarter, group = Year, data, type = "o")

Or you can use ggplot:

qplot(Quarter, Consumption, data=data,type=c("point","line"), id=data$Year)

Unfortunately this has uncovered a couple of small bugs for me to fix (no automatic legend, and have to specify the data frame explicitly)

The slighly more verbose example below shows you what it should look like.

data$Year <- factor(data$Year)
p <- ggplot(data, aes=list(x=Quarter, y=Consumption, id=Year, colour=Year)) ggline(ggpoint(p), size=2)


Hadley mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed Jul 26 17:58:11 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 27 Jul 2006 - 10:17:43 EST.

Mailing list information is available at Please read the posting guide before posting to the list.