Re: [R] Adding lines to xYplot

From: Bernd Weiss <bernd.weiss_at_uni-koeln.de>
Date: Sun 28 Jan 2007 - 05:40:46 GMT

Am 27 Jan 2007 um 20:13 hat Michael Kubovy geschrieben:

To: "r-help@stat.math.ethz.ch list" <rhelp @stat.math.ethz.ch>

From:           	Michael Kubovy <kubovy@virginia.edu>
Date sent:      	Sat, 27 Jan 2007 20:13:15 -0500
Subject:        	[R] Adding lines to xYplot

> I am using xYplot to plot data and CIs. How do I add several lines to
> the figure?

It's not clear what you mean by "add several lines". Maybe <panel.abline> is what you are looking for? Another option might be to use <panel.xYplot(x,y,subscripts,type="b")>...

HTH, Bernd

# Examples of plotting raw data
dfr <- expand.grid(month=1:12,
continent=c('Europe','USA'),sex=c('female','male'))

set.seed(1)

dfr <- upData(dfr, y=month/10 + 1*(sex=='female') + 2*(continent=='Europe') +

              runif(48,-.15,.15),
              lower=y - runif(48,.05,.15),
              upper=y + runif(48,.05,.15)
			  )

xYplot(Cbind(y,lower,upper) ~ month,
subset=sex=='male' & continent=='USA',
panel=function(x,y,subscripts){panel.xYplot(x,y,subscripts); ## add lines to the graph which denote means of x and y panel.abline(h=mean(y),v=mean(x))},data=dfr)



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. Received on Sun Jan 28 16:46:35 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 28 Jan 2007 - 06:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.