[R] Simple lattice graphics question

Deepayan Sarkar deepayan at stat.wisc.edu
Wed May 5 00:39:07 CEST 2004


On Tuesday 04 May 2004 05:05 pm, Sean Davis wrote:
> Dear all,
>
> I am using panel graphics to do a stripplot of a variable versus a shingle
> and putting a loess curve on the stripplot.  I want the data jittered, but
> I can't seem to get the panel function to work.  This jitter's the data,
> but
>
> of course doesn't give me the loess:
> > stripplot((g[,3]) ~ c,jitter=T,pch=".",scales=list(y=list(log=T)))
>
> But this doesn't give me any jittering.  What am I missing?
>
> > stripplot(jitter(g[,3]) ~
> > c,scales=list(y=list(log=T)),panel=function(x,y)
>
> {panel.stripplot(x,y,pch='.'); panel.loess(x,y,span=1)},jitter=T)

?panel.stripplot says:

Usage:

     panel.stripplot(x, y, jitter.data = FALSE, factor = 0.5,
                     horizontal = TRUE, groups = NULL,
                     ...)


You are never passing the jitter.data argument to it, so it's using the 
default. There's more than one way around this, but I would probably do 

panel=function(x,y,...) {
    panel.stripplot(x,y,pch='.',...)
    <etc etc>
}

Deepayan




More information about the R-help mailing list