[R-sig-Geo] Plotting data with multiple symbols and colours

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Wed Mar 14 12:03:01 CET 2007


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




More information about the R-sig-Geo mailing list