[R-sig-Geo] Changing color ramp in spplot()

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Mar 19 16:04:22 CET 2010


Aleksey,

It seems you missed the documentation of ?spplot, or misunderstood. It
describes a col.regions argument, which accepts a color ramp.

spplot is a relatively thin wrapper around the functions xyplot (for
points or lines) or levelplot (for areas) in package lattice. If you
want to do all kind of fancy things, you might want to have a look at
their documentation.

Best regards,

Aleksey Naumov wrote:
> Dear R experts,
> 
> I am new to using the "sp" package and I am wondering how does one change
> color palette in spplot()? The problem is that when I do:
>> library(sp)
>> data(meuse)
>> coordinates(meuse) = c("x","y")
>> spplot(meuse, "zinc")
> 
> the middle class (zinc concentrations (803.4, 1149]) is plotted in white and
> is therefore not visible on the graph. I guess this is due to the default
> cyan-magenta color palette used in "lattice". I tried changing the colors
> via (a) manipulating the lattice settings, and (b) arguments to spplot, but
> could not get it to work. How does one go about changing the default color
> ramp?
> 
> I also tried using the "panel" argument to extend the default
> panel.pointsplot panel function used here, to make sure that all points are
> visible (perhaps, as open circles, which are then filled in by
> panel.pointsplot), but could not figure out how to do it right.
> 
> Would appreciate any ideas.
> 
> Thank you,
> Aleksey
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
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