[R] lattice levelplot axis + custom annotations

David Winsemius dwinsemius at comcast.net
Sun May 3 14:39:49 CEST 2009

On May 2, 2009, at 11:05 PM, Alex Reynolds 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?

Yes. Unfortunately, I have no experiences with sticking polygons on  
axes. If you could live with the labels of your particular items, then  
this example was modified from the ones on the help page for  

levelplot(x[, col.ord],
           aspect = "iso",xlab="",ylab="",
           scales = list(x=list(draw=F), y= list(at=c(1,10,15))),
           colorkey = FALSE,
           legend =
           list(right =
                list(fun = dendrogramGrob,
                     args =
                     list(x = dd.col, ord = col.ord,
                          side = "right",
                          size = 10))))

There is a panel.polygon function but my reading of Sarkar's Lattice  
book suggests that it would only draw within a plotting region. I  
don't have Murrell's Grid Graphics, which I suspect may contain the  
> Unfortunately, it's not clear from the example or help description  
> how I would go about that.

The example to which I used after some guesswork, or another?

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

More information about the R-help mailing list