Hi, I have this plotting problem in lattice and appreciate any comments. Say, I want to plot observed drug concentrations in point and prediction in line xyplot(CONC~TIME,data=df1, panel=function(x,y,...){ panel.xyplot(x,y,type='p',col='blue') PRED=df1$PRED panel.xyplot(x,PRED,type='l',col='red',lwd=2) } ) This is working fine. Now I want to make the plot conditional on some variable "TRT". It didn't work. I guess this is because the two panel.xyplot functions have different "y", CONC and PRED. Only CONC is conditional on TRT but not PRED. df1 is a data frame with elements TIME, CONC, PRED,.... Appreciate any comments. xyplot(CONC~TIME|*TRT*,data=df1, panel=function(x,y,...){ panel.xyplot(x,y,type='p',col='blue') PRED=df1$PRED panel.xyplot(x,PRED,type='l',col='red',lwd=2) } ) -- Jun Shen PhD PK/PD Scientist BioPharma Services Millipore Corporation 15 Research Park Dr. St Charles, MO 63304 Direct: 636-720-1589 [[alternative HTML version deleted]]