In the "filled bands" part of xYplot of the Hmisc package, is there a way to have multiple bands with multiple lines? or does it just allow one for now? So I had an example bit ago had a made up line and CI, now if I wanted to make a second line with a CI filled in can I put them on the same plot? x<-seq(1,10,1) y<-seq(1,10,1) ci<-y*.10 ciupper<-y+ci cilower<-y-ci xYplot(Cbind(y,cilower,ciupper)~x, method="filled bands", col.fill="light grey", type=c("b")) x2<-seq(1,5,.5) y2<-seq(1,5,.5) ci2<-y2*.10 ciupper2<-y2+ci2 cilower2<-y2-ci2 xYplot(Cbind(y2,cilower2,ciupper2)~x2, method="filled bands",col.fill="light grey", type=c("b")) ------------------------------------------- Joe King, M.A. Ph.D. Student University of Washington - Seattle 206-913-2912 jp@joepking.com ------------------------------------------- "Never throughout history has a man who lived a life of ease left a name worth remembering." --Theodore Roosevelt [[alternative HTML version deleted]]
On Nov 26, 2009, at 10:26 PM, Joe King wrote:> In the "filled bands" part of xYplot of the Hmisc package, is there > a way to > have multiple bands with multiple lines? or does it just allow one > for now?No problem as long as you use groups... which means you probably ought to be providing a dataframe format with a grouping factor. (At least that was how I read the help page saying that: --------- Details Unlike xyplot, xYplot senses the presence of a groups variable and automatically invokes panel.superpose instead of panel.xyplot. The same is true for Dotplot vs. dotplot. --------- I would give it a dataset that does not have lines coincident if you want to see them. (You should also get rid of that space in your color parameter. dfci <- structure(list(x = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5), y = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5, 4.5, 4, 3.5, 3, 2.5, 2, 1.5, 1), ciupper = c(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 11, 5.5, 4.95, 4.4, 3.85, 3.3, 2.75, 2.2, 1.65, 1.1), cilower = c(0.9, 1.8, 2.7, 3.6, 4.5, 5.4, 6.3, 7.2, 8.1, 9, 4.5, 4.05, 3.6, 3.15, 2.7, 2.25, 1.8, 1.35, 0.9), grp = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("1", "2"), class = "factor")), .Names = c("x", "y", "ciupper", "cilower", "grp"), row.names = c(NA, -19L), class = "data.frame") xYplot(Cbind(y,cilower,ciupper)~x, groups=grp, data=dfci, method="filled bands",col.fill="lightgrey", type=c("b")) -- David> > > > So I had an example bit ago had a made up line and CI, now if I > wanted to > make a second line with a CI filled in can I put them on the same > plot? > > > > x<-seq(1,10,1) > > y<-seq(1,10,1) > > ci<-y*.10 > > ciupper<-y+ci > > cilower<-y-ci > > > > xYplot(Cbind(y,cilower,ciupper)~x, method="filled bands", > col.fill="light > grey", type=c("b")) > > > > x2<-seq(1,5,.5) > > y2<-seq(1,5,.5) > > ci2<-y2*.10 > > ciupper2<-y2+ci2 > > cilower2<-y2-ci2 > > > > xYplot(Cbind(y2,cilower2,ciupper2)~x2, method="filled > bands",col.fill="light > grey", type=c("b")) > > > > ------------------------------------------- > > Joe King, M.A. > > Ph.D. Student > > University of Washington - Seattle > > 206-913-2912 > > jp at joepking.com > > ------------------------------------------- > > "Never throughout history has a man who lived a life of ease left a > name > worth remembering." --Theodore Roosevelt > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.David Winsemius, MD Heritage Laboratories West Hartford, CT
do you mind me asking what code you used to create that data frame and name the groups 1 and 2? David Winsemius wrote:> > > On Nov 26, 2009, at 10:26 PM, Joe King wrote: > >> In the "filled bands" part of xYplot of the Hmisc package, is there >> a way to >> have multiple bands with multiple lines? or does it just allow one >> for now? > > No problem as long as you use groups... which means you probably ought > to be providing a dataframe format with a grouping factor. (At least > that was how I read the help page saying that: > --------- > Details > Unlike xyplot, xYplot senses the presence of a groups variable and > automatically invokes panel.superpose instead of panel.xyplot. The > same is true for Dotplot vs. dotplot. > > --------- > > > I would give it a dataset that does not have lines coincident if you > want to see them. > > (You should also get rid of that space in your color parameter. > > dfci <- structure(list(x = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1.5, 2, > 2.5, 3, 3.5, 4, 4.5, 5), y = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5, 4.5, > 4, 3.5, 3, 2.5, 2, 1.5, 1), ciupper = c(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, > 7.7, 8.8, 9.9, 11, 5.5, 4.95, 4.4, 3.85, 3.3, 2.75, 2.2, 1.65, 1.1), > cilower = c(0.9, 1.8, 2.7, 3.6, 4.5, 5.4, 6.3, 7.2, 8.1, 9, 4.5, 4.05, > 3.6, 3.15, 2.7, 2.25, 1.8, 1.35, 0.9), grp = structure(c(1L, 1L, 1L, > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L), .Label = c("1", "2"), class = "factor")), .Names = c("x", "y", > "ciupper", "cilower", "grp"), row.names = c(NA, -19L), class = > "data.frame") > > xYplot(Cbind(y,cilower,ciupper)~x, groups=grp, data=dfci, > method="filled bands",col.fill="lightgrey", type=c("b")) > > -- > David > > >> >> >> >> So I had an example bit ago had a made up line and CI, now if I >> wanted to >> make a second line with a CI filled in can I put them on the same >> plot? >> >> >> >> x<-seq(1,10,1) >> >> y<-seq(1,10,1) >> >> ci<-y*.10 >> >> ciupper<-y+ci >> >> cilower<-y-ci >> >> >> >> xYplot(Cbind(y,cilower,ciupper)~x, method="filled bands", >> col.fill="light >> grey", type=c("b")) >> >> >> >> x2<-seq(1,5,.5) >> >> y2<-seq(1,5,.5) >> >> ci2<-y2*.10 >> >> ciupper2<-y2+ci2 >> >> cilower2<-y2-ci2 >> >> >> >> xYplot(Cbind(y2,cilower2,ciupper2)~x2, method="filled >> bands",col.fill="light >> grey", type=c("b")) >> >> >> >> ------------------------------------------- >> >> Joe King, M.A. >> >> Ph.D. Student >> >> University of Washington - Seattle >> >> 206-913-2912 >> >> jp at joepking.com >> >> ------------------------------------------- >> >> "Never throughout history has a man who lived a life of ease left a >> name >> worth remembering." --Theodore Roosevelt >> >> >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at 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. > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > ______________________________________________ > R-help at 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. > >-- View this message in context: http://old.nabble.com/layers-in-xYplot-of-Hmisc-tp26537542p26541016.html Sent from the R help mailing list archive at Nabble.com.