[R] xyplot - label one line

taz9 alienz747 at gmail.com
Tue Apr 7 21:10:18 CEST 2009


Hi All,

I have a panel xyplot with 2 lines in each panel. I'd like to label one line
only but don't know how to do this. The code below labels both lines. Any
ideas on how I could change it to show the y-values of only one of the
lines? Many thanks!

xyplot(apples + bananas ~ year | category, data=fruit, as.table=TRUE,
          par.strip.text=list(cex=1.2,font="bold"),
          auto.key=list(text=(c("Successful Crops","Unsuccessful Crops")),
columns=2, corner=c(1,0)),
          panel = function(x, y, groups, subscripts, ...) {
          panel.grid(h = -1,v = 0)
         grid.text( unit( x, "native") , unit( y, "native") ,
          label =y, gp = gpar( cex = 0.9, fontface="bold"), hjust=c(1,1),
vjust=c(-1,-1))
           panel.superpose.2(x = x, y = y, groups = groups, subscripts =
subscripts,...)},
       type = c("p", "o"))
-- 
View this message in context: http://www.nabble.com/xyplot---label-one-line-tp22935488p22935488.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list