Take the 2-minute tour ×

I have a lattice chart showing three series, labelled A,B,C in the strips. Within the charts I have added the max value using panel.text. But how can I add this information within the strips, next to the strip name? (eg in the top strip: A max value=2.61)

 #Libraries used:
 #Data: Create three random walks:
 A <-  c(rnorm(99), cumsum(rnorm(99)))
 #combine data into a dataframe:
 df1 <- data.frame(A,B,C)

 #create a time series for use in xyplot:

 ts1 <- ts(df1, start=-100, end=-1, frequency=1) 

#create a lattice chart:

chart1 <-xyplot(ts1    ,



lab1 <- names(y)
panel.text(-80,min( y)*0.9, paste(lab1,"max:",max(y)), cex = 1.2, font =2,col="blue") 

Thank you for your help.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can rename the strip labels:

chart1 <-xyplot(ts1    ,    
strip= strip.custom(factor.levels=paste(dimnames(ts1)[[2]],"max value =",round(apply(ts1,2,max),2)))    
share|improve this answer
Thank you very much. Is there a way to include the strip.custom function within the panel group so it could take an output from a panel function which would then be printed in the strip? –  adam.888 Sep 27 '13 at 23:15
strip is an argument to the high-level xyplot function, not the panel function. I guess that by the time the individual panels are drawn, the strip labels have already been determined. You were able to determine the max for each panel, but I don't think you can alter each strip label. –  DaveTurek Sep 30 '13 at 11:51
Maybe you could have blank strip labels then fiddle with panel.text to place your text in the strip. But do you have an example of why you need this? –  DaveTurek Sep 30 '13 at 11:55

Your Answer


