Edzer,

Thank you for your help. I did overlook col.regions argument in spplot.
However, in trying to trace down the exact meaning of this argument, I could
not find it in either xyplot() or it's panel function panel.xyplot(), which,
as you indicated, would be used in this case (since we are plotting points).
Instead, I found col.regions in panel.levelplot; so is panel.levelplot()
used in this case, even though we are not plotting areas?

The following syntax works for me:
> spplot(meuse, "zinc", col.regions=colorRampPalette(c('blue', 'gray80',
'red'))(5))

but it requires that I specify the number of colors explicitly (5 in this
case). Is there a way to specify just a palette function, and the number of
colors would be figured out automatically by lattice? Simply providing the
palette function like colorRampPalette or cm.colors does not work:
> spplot(meuse, "zinc", cuts=7, col.regions=cm.colors)
Error in col.regions[cols] : object of type 'closure' is not subsettable

Thank you,
Aleksey



On Fri, Mar 19, 2010 at 11:04 AM, Edzer Pebesma <
edzer.pebesma@uni-muenster.de> wrote:

> 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@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@wwu.de
>

	[[alternative HTML version deleted]]

