Dear users, I am new to R and have couple of problems with xyplot. A) I am trying to use the xyplot to plot mean concentration vs time across 5 dose groups. When i use the following script xyplot(mean~time,groups=dose,type="b",panel=panel.superpose). R generates the plot, but i have no control over pch or color for the line. It displays whatever color and pch it wants to generate. How do i fix this. B) I am trying to use the same function to plot individual data across dose groups xyplot(conc~time|dose,groups=subject,type="l") works. But it would be great if anyone can shed light on how to superimpose the mean profile for each dose group within that panel Any help will be appreciated Thanks Kumar -- View this message in context: http://r.789695.n4.nabble.com/help-on-panel-superpose-tp3687965p3687965.html Sent from the R help mailing list archive at Nabble.com.
For the first part, use the col and pch arguments: id<-rep(c(0,2),each=50) e<-rnorm(100) x<-rnorm(100) y<-id+x+e xyplot(y~x,groups=id,col=c(3,4),pch=c(12,13)) For the second part, I do not know what exactly mean by superimpose the mean level? Should the mean for each group be displayed as a horizontal line? Best, Daniel Bharath Kumar wrote:> > Dear users, > > I am new to R and have couple of problems with xyplot. > > A) I am trying to use the xyplot to plot mean concentration vs time across > 5 dose groups. > > When i use the following script > xyplot(mean~time,groups=dose,type="b",panel=panel.superpose). R generates > the plot, but i have no control over pch or color for the line. It > displays whatever color and pch it wants to generate. How do i fix this. > > B) I am trying to use the same function to plot individual data across > dose groups > > xyplot(conc~time|dose,groups=subject,type="l") works. But it would be > great if anyone can shed light on how to superimpose the mean profile for > each dose group within that panel > > Any help will be appreciated > Thanks > Kumar >-- View this message in context: http://r.789695.n4.nabble.com/help-on-panel-superpose-tp3687965p3688225.html Sent from the R help mailing list archive at Nabble.com.
I too am unsure what is required, perhaps xyplot(y~x,data,col=c(3,4),groups=id,pch=c(12,13), type= c("p","r")) a toy dataset would have helped Perhaps a perusal of http://lmdvr.r-forge.r-project.org/figures/figures.html is required Regards Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email: home mackay at northnet.com.au At 11:30 23/07/2011, you wrote:>For the first part, use the col and pch arguments: > >id<-rep(c(0,2),each=50) >e<-rnorm(100) >x<-rnorm(100) >y<-id+x+e >xyplot(y~x,groups=id,col=c(3,4),pch=c(12,13)) > >For the second part, I do not know what exactly mean by superimpose the mean >level? Should the mean for each group be displayed as a horizontal line? > >Best, >Daniel > > > >Bharath Kumar wrote: > > > > Dear users, > > > > I am new to R and have couple of problems with xyplot. > > > > A) I am trying to use the xyplot to plot mean concentration vs time across > > 5 dose groups. > > > > When i use the following script > > xyplot(mean~time,groups=dose,type="b",panel=panel.superpose). R generates > > the plot, but i have no control over pch or color for the line. It > > displays whatever color and pch it wants to generate. How do i fix this. > > > > B) I am trying to use the same function to plot individual data across > > dose groups > > > > xyplot(conc~time|dose,groups=subject,type="l") works. But it would be > > great if anyone can shed light on how to superimpose the mean profile for > > each dose group within that panel > > > > Any help will be appreciated > > Thanks > > Kumar > > > >-- >View this message in context: >http://r.789695.n4.nabble.com/help-on-panel-superpose-tp3687965p3688225.html >Sent from the R help mailing list archive at Nabble.com. > >______________________________________________ >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.