[R-sig-Geo] How to show the color ramp legend with discrete data in spplot ?

Edzer Pebesma edzer.pebesma at uni-muenster.de
Sat Jan 19 19:29:57 CET 2013



On 01/19/2013 07:14 PM, Oscar Perpiñan wrote:
>> Reflecting on that, it would involve a bit of programming, essentially
>> writing an appropriate panel function for lattice::levelplot. I did this
>> back then for polygons, found in sp:::panel.polygonsplot, which is 80
>> lines of R code. My guess is that it should be considerable more easy
>> for points. I'd be happy to receive & consider proposals.
>>
>> I think panel.levelplot.points from latticeExtra can be useful:
> http://latticeextra.r-forge.r-project.org/#panel.levelplot.points
> 
> Best,
> 
> Oscar.
> 

Thanks!

Sth like

library(latticeExtra)
library(sp)
loadMeuse()
levelplot(zinc~x+y, as.data.frame(meuse), panel=panel.levelplot.points,
    aspect = "iso", scales = list(draw=FALSE), xlab=NULL, ylab = NULL,
    colorkey = list(space = "bottom"))


would get you close, you might want to control xlim and ylim further.

I'll see how I can integrate this with spplot.

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list