Skip to content
Prev 157048 / 398506 Next

lattice xyplot symbols instead of colors and legend matching plot symbols or colors

I would like to use the data below where the plots are close to what I
want.  Instead of color I would like to use different symbols, and
have the symbols in the legend match the graphs.  I am also going to
add a regression line to these I know about the type="r" (which is
fine for these particular graphs) argument, but it fits the subsets
instead of the entire data set-- should I use a list of regression
fits in the order of the arguments in an abline panel to do this?  Ok,
I think that is all for right now.  If I need to clarify please tell
me.
thanks

f <- structure(list(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, 0.417618143,
0.741080504, 0.412440872, 3.515743675, 8.248491445, 1.537773727,
3.249103284, 0.768531626, 2.633107621, 3.113199095, 0.773824094,
0.680150068, 0.026385752, 0.369310858, 8.049276658, 7.487378383,
0.763580377, 0.333244629, 5.475999014, 9.235631398), TSS = c(2.8,
8.4, 11, 1.3, 4.2, 2, 3.4, 14, 8.2, 3.1, 1.4, 0.9, 6.1, 9.2,
11, 1.2, 1.3, 11, 8.5, 13, 4.4, 1.4, 2.1, 25, 9.3, 6.1, 1.6,
1.5, 24, 9.6, 1.8, 1.4), Iron = c(0.74, 0.54, 0.23, 0.13, 0.4,
0.13, 0.15, 0.58, 0.38, 0.22, 0.13, 0.07, 0.32, 0.26, 0.86, 0.13,
0.09, 0.58, 0.35, 0.59, 0.33, 0.19, 0.21, 0.81, 0.34, 0.31, 0.07,
0.16, 0.54, 0.36, 0.13, 0.07), TIN.TP = c(3.117647059, 2.736842105,
2.25, 22, 3, 2.428571429, 6.428571429, NA, NA, 2.384615385, 3,
NA, 3.25, NA, 3.166666667, 9, 23, 3.5, 11, 3.916666667, 3.4,
3.444444444, 8.75, 2.733333333, 3.583333333, 2.75, 17, NA, 2.933333333,
2.533333333, 2.5, 11), RiverMile = c(148L, 179L, 185L, 202L,
179L, 185L, 190L, 119L, 148L, 179L, 185L, 202L, 119L, 202L, 148L,
190L, 202L, 148L, 202L, 119L, 179L, 185L, 190L, 61L, 119L, 148L,
202L, 202L, 119L, 148L, 185L, 202L)), .Names = c("GPP", "TSS",
"Iron", "TIN.TP", "RiverMile"), class = "data.frame", row.names = c(1L,
2L, 3L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 15L, 16L, 19L,
22L, 23L, 30L, 34L, 36L, 37L, 38L, 39L, 43L, 44L, 45L, 46L, 47L,
49L, 50L, 51L, 52L))

xyplot(GPP~(1/Iron)+(1/TSS)+TIN.TP, groups=RiverMile,data=f,
scales=list(relation="free"), pch=20, auto.key=TRUE)