Hi all, is it possible to dynamically add key items to an already existing key, belonging to a lattice xyplot?
This is what I do: I make an xyplot with an initial key. Later on, I want to extend this key with more items, as more lines are added to the plot (lines are added using trellis.focus("panel")). I guess I need some function to access the key panel in order to extend it, i.e., by using something like trellis.focus("legend"), but this only yields errors. Also, in the lattice documentation, the only separate key function I could find is draw.key(), no functions to add individual key items. anyone has more info on dynamically adding items to keys in xyplots? thanks, Bram Kuijper this is the code for my lattice xyplot plot: print(xyplot(current_data$FemDiploidUninf ~ current_data$generation, ylim=c(0,2000), scales=list(x=list(tick.number=4)), par.settings=list(plot.line=list(col='red')), type="l", key=list(text=list(c("blah","blah2")),x=0.5,y=0.5,lines=list(type="l",col="red")), ),newpage=FALSE) # add another line to plot trellis.focus("panel") ... trellis.unfocus() # focus on the existing key trellis.focus("legend",1,1,highlight=FALSE) ?? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.