On Fri, Nov 20, 2009 at 7:47 AM, Joe King <j...@joepking.com> wrote: > I have been using lattice xyplot and am quite pleased, and I can use the > type=c("b","g") to have it print gridlines into the page, yet if I want to > have a line plot with points on it, how do I get the xYplot to print > gridlines (I use Hmisc xYplot because of its bands method which allows > plotting of confidence intervals). Any suggestions? I have looked at the > panel functions but when I try it I get the gridlines but my data is gone. > > > > So a simple example is below. I want to create the reference lines in the > lattice plot in the xYplot from Hmisc so I can keep the confidence intervals > filled. > > > > x<-seq(1,10,1) > > y<-seq(1,10,1) > > ci<-y*.10 > > ciupper<-y+ci > > cilower<-y-ci > > > > xyplot(y~x, type=c("b","g"),plot.points = TRUE)#using lattice > > > > xYplot(Cbind(y,cilower,ciupper)~x,col.fill="grey",plot.points = > TRUE,type=c("b"),method="filled bands")#using Hmisc
As ?panel.xyplot tells you, type="g" is just a shortcut that calls panel.grid(), so you get the equivalent effect with xYplot(Cbind(y,cilower,ciupper)~x,col.fill="grey",plot.points = TRUE, type="b",method="filled bands", panel = function(...) { panel.grid(h = -1, v = -1) panel.xYplot(...) }) -Deepayan ______________________________________________ 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.