Skip to content

SpatialPolygon with the max value gets no color assigned in spplot function when using "at" parameter

2 messages · Jan Hornych, Roger Bivand

#
On Wed, 30 Jan 2013, Jan Hornych wrote:

            
I'm fairly sure I replied to this question very recently, but can't find 
the link. The at= argument in lattice graphics by default breaks [a, b), 
see:

http://en.wikipedia.org/wiki/Interval_(mathematics)#Excluding_the_endpoints

so the upper limit should be eased out beyond the maximum, here doing 
both for symmetry:

ats <- classIntervals(spdf$weight,4)$brks
ats[1] <- ats[1] - .Machine$double.eps
ats[length(ats)] <- ats[length(ats)] + .Machine$double.eps
spplot(spdf, "weight", at=ats)

This is described on the levelplot help page, linked from the spplot help 
page:

       at: A numeric vector giving breakpoints along the range of ?z?.
           ...  However, this also means that when supplying ?at?
           explicitly, one has to be careful to include values outside
           the range of ?z? to ensure that all the data are shown.

Hope this clarifies,

Roger