[R] plotting curve in xYplot -- using panel.curve

Dieter Menne dieter.menne at menne-biomed.de
Fri Jan 23 21:46:26 CET 2009




John Poulsen wrote:
> 
> I am trying to plot a curve over points plotted with se's in xYplot (see 
> example below).  I can get Figure 1 below to plot the data with error.  
> However, I keep getting a the error message
> 
> "Error using packet 1 object "y" not found"
> 
> Can anyone see what I am doing wrong?
> 
> Thanks!
> John
> 
> -------------------------------
> 
>  a=0.002; b=31.7; c=0.51
>  sds=rep(c(0,3,5,10,20,50,200), each=3)
>  y1=c(0,0,0.16, 0, 0.33,0.5, 0.16, 0.83, 1.16, 0.67, 0.5, 1.16, 0.83, 
> 2.33, 3.6, 5.5, 4.33, 1.16, 22, 13, 12)
>  lo=y1-0.1*y1
>  hi=y1+0.1*y1
>  
> # Figure 1
>  xYplot(Cbind(y1, lo, hi)~jitter(sds, amount=1), 
> method="bars",ylim=c(0,max(hi)+1),
>        ylab="Y", xlab="X")
> 
> # Figure 2
>  xYplot(Cbind(y1, lo, hi)~jitter(sds, amount=1), 
> method="bars",ylim=c(0,max(hi)+1),
>        ylab="Y", xlab="X",
>      panel=function(...){
>       panel.xYplot(x,y,...)
>       panel.number=panel.number()
>        panel.curve(curve(a*(x+c)/1+a*b*(x+c), from=0, type="l", lwd=2))
>         }
>          )
> 
> 
John Poulsen <jpoulsen <at> zoo.ufl.edu> writes:

> I am trying to plot a curve over points plotted with se's in xYplot (see 
> example below).  I can get Figure 1 below to plot the data with error.  
> However, I keep getting a the error message
> 
> "Error using packet 1 object "y" not found"
> -------------------------------
> 
>  a=0.002; b=31.7; c=0.51
>  sds=rep(c(0,3,5,10,20,50,200), each=3)
>  y1=c(0,0,0.16, 0, 0.33,0.5, 0.16, 0.83, 1.16, 0.67, 0.5, 1.16, 0.83, 
> 2.33, 3.6, 5.5, 4.33, 1.16, 22, 13, 12)
>  lo=y1-0.1*y1
>  hi=y1+0.1*y1
.. 
> # Figure 2
>  xYplot(Cbind(y1, lo, hi)~jitter(sds, amount=1), 
> method="bars",ylim=c(0,max(hi)+1),
>        ylab="Y", xlab="X",
>      panel=function(...){
>       panel.xYplot(x,y,...)
>       panel.number=panel.number()
>        panel.curve(curve(a*(x+c)/1+a*b*(x+c), from=0, type="l", lwd=2))
>         }
>          )
> 


Try
   panel=function(x,y,...){

Looks like it is not exactly what you expected, but the error is gone.

Dieter


-- 
View this message in context: http://www.nabble.com/plotting-curve-in-xYplot----using-panel.curve-tp21630200p21632361.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list