[R] lattice levelplot axis + custom annotations

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu May 7 00:25:20 CEST 2009


On Sat, May 2, 2009 at 8:05 PM, Alex Reynolds <reynolda at u.washington.edu> wrote:
> On May 2, 2009, at 5:08 PM, David Winsemius wrote:
>
>> Not sure since you have not provided a reproducible example and not really
>> defined what "annotations" means.
>
> By annotations, I mean that I want to draw an object (set of poiygon()
> elements that make up a genomic sequence logo), anchored at points along the
> y-axis of the levelplot, on the left side of the levelplot.
>
> I can't provide a "reproducible" example without adding a large set of files
> to this email, which will not get through the list. The graph itself is
> mostly fine; the code I provided in the previous email renders like so:
>
> http://www.flickr.com/photos/alexreynolds/3496072932/sizes/o/
>
> On that graph, I would like to draw polygon() elements at various points
> along the left edge of the levelplot. Does this make more sense?
>
> Unfortunately, it's not clear from the example or help description how I
> would go about that.

Your best bet would be to supply a custom axis function (see
?axis.default). For y-axes, It gets called with the y-axis already set
up, so you just need to draw (using grid) the polygons you need.
lattice will not know how much space needs to be reserved, so you will
probably need to control it manually using something like

par.settings = list(layout.widths = list(axis.left = 2))

-Deepayan




More information about the R-help mailing list