Skip to content
Prev 1857 / 29559 Next

Plotting data with multiple symbols and colours

Hi Edzer,

Thanks for your suggestions. Bubble() looks nice, but we are trying to
mimic the output from GSLIB. We're comparing R vs GSLIB, surfer and
VarioWin as a task in a course on spatial statistics. Our motto is:
"This is R. There is no if. Only how. (Simon Blomberg)" That's why we we
prefer your spplot solution.

The new code is:

library("sp")
library("RColorBrewer")
library("lattice")
set.seed(1)
Error <- SpatialPointsDataFrame(matrix(runif(1000), ncol = 2), data =
data.frame(error = runif(500, -10, 10)))
Error$sign <- sign(Error$error)
Error$abs <- abs(Error$error)
trellis.par.set(sp.theme(set = FALSE, regions = list(col =
rev(rainbow(50, start = 0, end = 4/6)))))
spplot(Error, zcol = "abs", pch = ifelse(Error$sign < 0, 95, 3),
key.space = "right", cuts = 0:10)

This is pretty much what we wanted. Except for the changes in pch in het
key. But I'll dig into xyplot and the source of spplot.

Thanks again,

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