[R] organising the display in Trellis plots

Deepayan Sarkar deepayan at stat.wisc.edu
Fri Dec 3 17:48:47 CET 2004


On Friday 03 December 2004 03:47, Marco Chiarandini wrote:
> Hallo,
>
> I would like to organise at my pleasure the layout of a trellis plot.
>
> Currently I have a 3x3 matrix display and 7 plots. Is it possible to
> choose which specific panels will stay empty?

Well, you have already specified 'layout', so the only issues are what 
order to plot the panels in, and where to plot them. I'm not sure which 
of these issues you are interested in (perhaps both).

To skip some panels, try 'skip', e.g., skip = c(F,F,F,T,F,T,F,F,F)

To change the order, you need to use index.cond (see below).

> I tried index.perm to arrange the order. Then there is perm.cond
> which I could not understand if it can serve for my purpose since I
> cant really find which kind of data it accepts.
>
> Thank you for the help.
>
>
> Marco
>
> P.S.  I attach some code.
>
> plot <- Dotplot(algo~Cbind(y,lower,upper) | group,data=OUT,
>                   pch=3, method="bars",pch.bar=2,lwd=3,
>                   cex=0.8,
>                   par.strip.text=list(cex=1),
>                   panel=function(x,y,...) {
>                     print(attr(x,'other'))
>                    
> panel.abline(v=attr(x,'other'),lty=2,col="grey70")
> panel.Dotplot(x,y,...)
>                   },
>                   scales = list(cex=1,rot=c(0,45),
>                    
> x=list(alternating=c(1,1,1,1),limits=c(1,nlevels(OUT$algo)),relation=
>"same"),
> y=list(at=c(1:nlevels(OUT$algo)),labels=levels(OUT$algo),alternating=
>c(1,1,1,1)) ),
>                 main=list(label=""),
>                   xlab=list(cex=1,label="Average rank"),
>                   ylab="",
>                   aspect="fill",as.table=FALSE,
>                   layout=c(3,3)
>                   )
>     print(plot)
>     update(plot,perm.cond=c(3,2,1,4,5,6))  #this does not work

>From ?xyplot, 

perm.cond: numeric vector, a permutation of '1:n', where 'n' is the
          number of conditioning variables. ...

In your case, n = 1, so this doesn't make sense.

>     update(plot,index.cond=c(3,2,1,4,5,6))  #this works it does not
> what I wish

index.cond needs to be a list of length n (one component for each 
conditioning variable), so you probably want

update(plot,index.cond=list(c(3,2,1,4,5,6)))

Deepayan




More information about the R-help mailing list