[R] Color of the plot which correspond to the group of the observations

2009-09-24 Thread FMH
Dear All,   Let: dp: depth of the river tp: temperature with respect to depth These pair of observations are in 3 different groups i.e: Obs. 1,3,5,7 from the first group Obs. 2,4 and 10 from second group Obs 6,8 and 9 from third group. We can have a simple scatter plot, between depth as y-axis

Re: [R] Color of the plot which correspond to the group of the observations

2009-09-24 Thread Richard M. Heiberger
It is easier in lattice dp - c(1,4,3,2,5,7,9,8,9,2) tp - 1:10 gg - rep(1:3, c(3,3,4)) ddff - data.frame(dp=dp, tp=tp, gg=gg) xyplot(dp ~ tp, groups=gg, data=ddff) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Color of the plot which correspond to the group of the observations

2009-09-24 Thread baptiste auguie
Try these three options, dp - c(1,4,3,2,5,7,9,8,9,2) tp - 1:10 group - factor(c(1, 2, 1, 2, 1, 3, 1, 3, 3, 2), label=letters[1:3]) plot(tp,dp, type= 'p', col = group) d - data.frame(dp=dp, tp=tp, group=group) library(lattice) xyplot(dp~tp, data=d, groups=group, auto.key=TRUE)

Re: [R] Color of the plot which correspond to the group of the observations

2009-09-24 Thread Jim Lemon
On 09/25/2009 04:28 AM, FMH wrote: Dear All, Let: dp: depth of the river tp: temperature with respect to depth These pair of observations are in 3 different groups i.e: Obs. 1,3,5,7 from the first group Obs. 2,4 and 10 from second group Obs 6,8 and 9 from third group. We can have a simple