On 8/30/07, Folkes, Michael <[EMAIL PROTECTED]> wrote:
> I've succeeded doing a subset within the panel function of xyplot - if I'm 
> subsetting based on either the value of 'x' or 'y' (e.g. below).  However, I 
> wish to subset based on the value of another variable and colour that one 
> plotted point.  It's not working.  Either it doesn't plot the coloured data 
> point, or if I sort the data differently it colours one datapoint, but the 
> wrong one.   I assume this means it's not getting the right subscripts?    
> Finally I can sort of see the light as if I remove the conditioning variable 
> (week) and subset before the xyplot (e.g. week==1) to get just one panel, it 
> plots the correct data including the correct single red point.
> Where am I erring?
> _______________________________________
> print(xyplot(yval~xval|week,data=mydata,
>  panel=function(x,y,subscripts){
>         #panel.xyplot(x,y,type='p',col=1,cex=.5)
>         panel.xyplot(x[y<=40],y[y<=40],type='p',col=2,cex=.5)  #  <-----this 
> works
>         
> panel.xyplot(x[mydata$yr==2005],y[mydata$yr==2005],type='p',pch=16,col=2,cex=.5)
>   #  <-----sometimes this won't work or it colours wrong datapoint
> }))
> ___________________________

Why not

xyplot(yval~xval|week,data=mydata, subset = yval < 40)

or

xyplot(yval~xval|week,data=mydata, subset = yr==2005)

-Deepayan

______________________________________________
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.

Reply via email to