[R] Lattice: how to index in a custom panel function?

Joris DeWolf Joris.DeWolf at cropdesign.com
Fri Aug 6 11:16:15 CEST 2004


I have a lattice xyplot that contains panels according to FactorA, and 
curves for the 2 levels of Factor B within a panel.
I try to add text in the panels of a lattice graph. I suppose I have to 
write a custom function (panel.txt).
What I really would like is to adapt the text in the panel according to 
the levels of FactorA.
In the manuals, I find examples for the strips using which.given and 
which.panel. But this does not work for the panels...

Can Anybody give a hint? Thanks

I work with R 1.9.1 under Linux

panel.txt = function(sometxt,x,y,...){

xyplot(data = Pdata, P ~ DAS | FactorA,
   groups = FactorB,
   type ="s",
   col = c("red","blue"),
  panel = function(x,y,...){
        panel.abline(h = 100, lty = 5, lwd =0.5, col = "darkgrey")
        panel.txt(mytext, 0.2, 0.8)


Joris De Wolf
CropDesign N.V. 
Plant Evaluation Group
Technologiepark 3 
B-9052 Zwijnaarde 
Tel. : +32 9 242 91 55
Fax  : +32 9 241 91 73

confidentiality notice:
The information contained in this e-mail is confidential and...{{dropped}}

More information about the R-help mailing list