[R] how to control lattice plot parameters

Paulo E. Cardoso pecardoso at netcabo.pt
Wed Apr 15 11:40:53 CEST 2009


I'm not being able to control all parameters of a xyplot.

dataset example:
> tabp[1:10,]
   time  n         X id       name
1     1 95  0.000000  1 Coral reef
2     1 93  0.000000  2 Coral reef
3     1 92  0.000000  3 Coral reef
4     1 90  0.000000  4 Coral reef
5     1 87  8.994321  5 Coral reef
6     1 86 12.580143  6 Coral reef
7     1 84 17.004030  7 Coral reef
8     1 83 18.469500  8 Coral reef
9     1 82 37.919033  9 Coral reef
10    1 81 39.059352 10 Coral reef
...

plot code:
xyplot(
      X~n,groups=name,data=tabp[tabp$time %in% c(1,4,8),],      
      ylab="% of target",
      xlab="PU selection Frequency",      
      lty=c(1,3,5), #! not responding
      xlim=c(-10,110),
      scales=list(cex=0.7,at=seq(0,360,by=20),labels=seq(0,360,by=20)), #!
not responding       
      panel=function(x,y,groups,subscripts)
      {
        panel.xyplot(x,y,
        subscripts=subscripts,
        groups=groups,
        type="l")
        panel.abline(h=30,lty=2,col="grey50")
      },
      key=list(
        space="top",
        columns=1,      
        text=list(levels(tabp$name)[c(2,5,11)]),
        lines=list(col=c("grey","blue","green"))
        )
      )

A few controls are not responding and I don't know how to:
1) control cex for xlab and ylab
2) control position of legend
3) control lty for each group level
4) control plot groups colors
5) match legend colors with graph colors
Any help will be very appreciated.

____________
Paulo E. Cardoso




More information about the R-help mailing list