[R] Custom colourkey spacing in levelplot, contourplot

r-help.20.trevva at spamgourmet.com r-help.20.trevva at spamgourmet.com
Tue Oct 23 13:27:47 CEST 2007

Dear R gurus,

I have got stuck on how to customise the colorkey generated by
levelplot and contourplot, in the lattice package. This best
illustrated by an example:


The reason for raising the volcano dataset to the 20th power is to
create a dataset with a large vertical exaggeration - this is similar
in nature to the data set that I am dealing with. Now, if you look at
the colorkey to the right of the plot, you'll see that its basically
dominated by the interval 1:10, and that the 0.001:0.01 color is
virtually invisible, even though it makes up quite a decent fraction
of the actual plot (its the light pink/lavendar colour between the
white and the magenta) .

So the question is, how can I customise the colourkey so that it
consists of five, equally spaced colour intervals, with the
appropriate annotation - in this case I am essentially try to have a
logarithmic distribution of the ticks, but you can imagine that there
will be cases when one wants something completely custom.



More information about the R-help mailing list