[R] ggplot adding points
hadley wickham
h.wickham at gmail.com
Fri Oct 10 16:44:06 CEST 2008
On Fri, Oct 10, 2008 at 9:18 AM, stephen sefick <ssefick at gmail.com> wrote:
> I would like to do the following in ggplot:
> what am I missing?
>
> River.Mile <-c(202, 198, 190, 185, 179, 148, 119, 61)
> TSS <- c(1:8)
> DOC <- seq(2, by= 0.6, length.out=8)
> z <- data.frame(River.Mile, TSS, DOC)
> xyplot(TSS+DOC~River.Mile, data=z, auto.key=TRUE)
You need to do the data manipulation yourself. The easiest way is to use melt:
zm <- melt(z, id = "River.Mile")
qplot(River.Mile, value, data=dz, colour = variable)
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list