Hi,
I have a problem where I would like to have both the colour and the symbol
varying in an spplot plot. Unfortunately, specifying a list of pch values
doesn't seem to work. See the following example
library(sp)
data(meuse)
coordinates(meuse) <- ~x +y
#Lets plot the elevation
spplot(meuse,"elev")
#And now the distance
spplot(meuse,"dist")
#Lets plot the points close to the river with open points
spplot(meuse,"elev",
colorkey=TRUE,
pch=ifelse(meuse$dist<0.3,1,16))
What I'm aiming for is to have all the points close to the river open
circles (pch=1), and all the points further from the river to be closed
(pch=16). However, the pch symbols don't seem to be propigating through
into the panel function correctly. The problem seems to arise somewhere the
Fill.call.groups() function, but I can't quite figure out where....
This type of trick is legitimate in lattice, which is where my inspiration
came from eg:
x <- rnorm(1000)
y <- rnorm(1000)
z <- sqrt(x^2 + y^2)
xyplot(y~x,pch=ifelse(z<1,16,1),asp="iso",cex=1)
As you can see, I have managed to change the symbol according to the
distance from the centre.
Am I asking too much of spplot to try and achieve this type of thing - we
are starting to getting pretty complex here! Or am I doing something wrong?
Best wishes,
Mark
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo