I am trying to figure out how to use ggplot2. I would like to do the below with ggplot, but I can not figure out how. The data provided is a subset of a much larger data set, but these data are the data necessary to make the plot. I think I would rather have the colors become symbols, and I do know how to do that in lattice, but here is a quick and dirty version. thanks
r <-(structure(list(TSS = c(2.8, 8.4, 11, 1.3, 4.2, 2, 3.4, 14, 8.2, 3.1, 1.4, 0.9, 0.5, 6.1, 9.2, 0.6, 1, 11, 2.4, 1.2, 1.3, 1.3, 0, 1.8, 8, 11, 11, 8.5, 8.5, 1.8, 13, 4.4, 1.4, 2.1, 0.5, 25, 25, 9.3, 6.1, 1.6, 1.5, 19, 19, 24, 9.6, 1.8, 1.4, 1), GPP = c(1.213695235, 3.817313822, 1.267930498, 10.45692825, 3.268295623, 3.505286001, 4.468225245, 0.915653726, 1.635617261, 3.726133898, 1.363453706, 13.99650967, 1.581182762, 0.417618143, 0.741080504, 1.366790205, 0.969326797, 0.412440872, 1.780215366, 3.515743675, 8.248491445, 0.125726306, 13.95880794, 4.850627229, -0.438311644, 1.537773727, 1.537773727, 3.249103284, 3.249103284, 2.470317011, 0.768531626, 2.633107621, 3.113199095, 0.773824094, 3.208461305, 0.680150068, 0.680150068, 0.026385752, 0.369310858, 8.049276658, 7.487378383, 0.950072035, 0.950072035, 0.763580377, 0.333244629, 5.475999014, 9.235631398, 2.587682905), RiverMile = c(148L, 179L, 185L, 202L, 179L, 185L, 190L, 119L, 148L, 179L, 185L, 202L, 215L, 119L, 202L, 198L, 215L, 148L, 198L, 190L, 202L, 215L, 198L, 198L, 215L, 148L, 148L, 202L, 202L, 215L, 119L, 179L, 185L, 190L, 198L, 61L, 61L, 119L, 148L, 202L, 202L, 61L, 61L, 119L, 148L, 185L, 202L, 215L )), .Names = c("TSS", "GPP", "RiverMile"), class = "data.frame", row.names = c(12L, 13L, 14L, 19L, 25L, 26L, 28L, 34L, 35L, 36L, 37L, 42L, 44L, 58L, 75L, 85L, 88L, 91L, 97L, 107L, 142L, 144L, 155L, 166L, 169L, 185L, 186L, 201L, 202L, 207L, 219L, 221L, 222L, 224L, 226L, 230L, 231L, 250L, 251L, 258L, 283L, 287L, 288L, 303L, 304L, 306L, 311L, 313L))) library(lattice) z <- nls(GPP~(a/(TSS+b)), start=c(a=0.01, b=0.01), data=r) f <- seq(-1, 29, length=100) y <- coef(z)["a"]/(f+coef(z)["b"]) xyplot(GPP~TSS, data=r, xlim=c(-0.5, 29), groups=RiverMile ,auto.key=TRUE , pch=20 ,panel=function(...) {panel.xyplot(...) llines(f, y) } ) -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis [[alternative HTML version deleted]] ______________________________________________ R-help@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.