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

From: hadley wickham <h.wickham_at_gmail.com>
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:

install.packages("ggplot")
library(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)

Regards,

Hadley



R-help@stat.math.ethz.ch 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 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.