Re: [R] dynamically add items to key of lattice xyplot

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Tue, 5 Feb 2008 12:32:04 -0800

On 2/5/08, Bram Kuijper <a.l.w.kuijper_at_rug.nl> wrote:
> Hi all,
>
> is it possible to dynamically add key items to an already existing key,
> belonging to a lattice xyplot?

No.

-Deepayan

> 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_at_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.
>



R-help_at_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. Received on Tue 05 Feb 2008 - 20:35:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Feb 2008 - 21:30:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive