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
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
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
Aleksey Naumov wrote:
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
spplot(meuse, zinc, cuts=7, col.regions=cm.colors)
Error in col.regions[cols] : object of type 'closure' is not subsettable
no, you need to pass colors, not a color palette generating function.
Have you tried?
spplot(meuse, zinc, cuts=7, col.regions=cm.colors())
Iuri Gavronski wrote:
spplot(meuse, zinc, cuts=7, col.regions=cm.colors)
Error in col.regions[cols] : object of type 'closure' is not subsettable
no, you need to pass colors, not a color palette generating function.
Have you tried?
spplot(meuse, zinc, cuts=7, col.regions=cm.colors())
Have