Plotting data with multiple symbols and colours
I would try the alternative, bubble(Error,maxsize=1.5) bubble(Error,maxsize=1.5, key.entries=-10:10) Doing what you want with spplot, you're basically thrown back at xyplot with asp="iso"; look at how key is formed there; with spplot(Error, pch = ifelse(Error$error < 0, 95, 3), key.space = "right", cuts = -10:10) I get funny pch changes in the key. I think that spplot passes an optional key argument to xyplot. -- Edzer
ONKELINX, Thierry wrote:
Dear listeRs,
We're trying to create a map with interpolation errors of some spatial
data. The idea is to plot the errors at the location of the data, with a
"+" or "-" symbol to indicate whether they are positive or negative and
a colour ramp that indicates the magnitude of the error. For now, we
managed to get a plot with the correct symbols. But the colour ramp only
works for the positive errors. The code to generate this:
library("sp")
library("RColorBrewer")
library("lattice")
set.seed(1)
Error <- SpatialPointsDataFrame(matrix(runif(1000), ncol = 2), data =
data.frame(error = runif(500, -10, 10)))
trellis.par.set(sp.theme(set = FALSE, regions = list(col = c(rainbow(50,
start = 0, end = 4/6), rev(rainbow(50, start = 0, end = 4/6))))))
spplot(Error[Error$error >= 0, ], zcol = "error", sp.layout =
list("sp.points", Error[Error$error < 0, ], pch = 95), key.space =
"right", cuts = seq(-10, 10, length = 21), pch = 3)
The questions:
1. For do we set the colour ramp for the negative values?
2. Can we change the key so it displays only absolute values or "-" in
front of the negative values?
All help is welcome.
Thierry
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be
Do not put your faith in what statistics say until you have carefully
considered what they do not say. ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo