Skip to content

levelplot colorkey

2 messages · Jeff Jorgensen, Deepayan Sarkar

#
Dear R'ers,

I've scanned available documentation and the web, but I can't seem to 
figure out where I've gone wrong in adding numbers to scale the colorkey in 
levelplot (Lattice package).  For example,

levelplot(z, contour=T, labels=T, cuts=10, region=T,...
            colorkey=list(T, space="bottom",
                           at=seq(0,2000,length=20),
                                 labels=list(as.character(seq(0,2000,length=20))))
)

If I leave out the colorkey command the levelplot function works great, if 
I put it in I get the following error mesage:

Error in draw.colorkey(x$colorkey) : length(col) must be length(at)-1

Is there a way to find out length(col) (BTW, does col=color?) so that I can 
readjust the label locations (at=...), or have I completely missed 
something obvious that would quickly fix this up?


Cheers,

Jeff Jorgensen

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Jeff Jorgensen

Center for Limnology                             jcjorgensen at wisc.edu
University of Wisconsin Madison           ph (608) 263-2304
680 North Park Street                           fx (608) 265-2340
Madison, Wisconsin 53706                http://limnology.wisc.edu

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
On Tuesday 10 February 2004 18:07, Jeff Jorgensen wrote:
^
                      what's this for ?
I think you wanted to do 

colorkey = list(space = "bottom",
                labels = list(at = seq(0,2000,length=20),
                              lab = seq(0,2000,length=20)))

and then you would have changed the 20 to 21 :-)

Deepayan