[R] Annotate a levelplot (using abline) - Difficulty with trellis.

From: Dan Bolser <dan.bolser.r_at_googlemail.com>
Date: Wed 04 Apr 2007 - 11:19:18 GMT


Hi,

I am generating a beautiful plot with the 'levelplot' function over my square matrix of data. In order to help visualise the data I would like to draw a diagonal line on the matrix. Because the plot is actually a trellis object, I am having difficulty working out how to do this. I have been reading around, but I don't see any easy solution to the problem. (Most of the docs I have found are not of the type 'how to do it' but more like 'how to grok it'). After spending 1+ hour reading and trying various things I figure its time to ask some people who know ;-)

So far I have the following (which almost works!)...

    levelplot(

                our.data,
                plot.xy = (abline(0,1,col="white"))
                )

However the coordinate system / plot area being used are clearly not those of the square matrix. I guess I should point out that the axes of 'our.data' (the row and column names of the square matrix) are ordered categories of the form;

    seq(2,9,0.5)

Thanks for any help !

Dan.



R-help@stat.math.ethz.ch 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 Wed Apr 04 21:24:20 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 04 Apr 2007 - 13:31:00 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.