[R] Annotate a levelplot (using abline) - Difficulty with trellis.
Dan Bolser
dan.bolser.r at googlemail.com
Wed Apr 4 13:19:18 CEST 2007
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.
More information about the R-help
mailing list