[R] annotating individual panels produced by xyplot

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Sep 2 22:28:51 CEST 2008


On Tue, Sep 2, 2008 at 1:23 PM, Martin Brown <mjb2000 at gmail.com> wrote:
> Hi all,
>
> I'm new to R and lattice and panel functions.  I've produced a lattice
> graph using xyplot.  Now I would like to add various, and *different*,
> annotations to each individual panel.  I tried something like this,
> using panel.text  ...
>
> <code>
> xyplot(dent ~ era | vegzone,
>           groups=seedtype,
>                        panel=function(...) {
>                                panel.xyplot(...)
>                                panel.text(6.5,50,labels="my 1st annotation")
>                                panel.text(6.5,70,labels="my 2nd annotation")  } )
> </code>
>
> ... but that didn't work, as both annotations appeared in all panels.
> I want to control which panel each annotation appears in.  I feel
> there must be a way to assign the contents of panel text to individual
> panels, or to make a list of coordinates and annotations and have them
> meted out over the various panels.  However, I've searched through the
> R-help archives and just can't figure it out.
>
> Any tips would be appreciated.  Thanks so much!

See ?packet.number

-Deepayan



More information about the R-help mailing list