An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140307/5b67f7c7/attachment.pl>
Spplot: Specifying individual point symbols
4 messages · Mark Payne, Oscar Perpiñan
Use groups instead: spplot(meuse["elev"], groups=ifelse(meuse$dist < 0.3, 1, 2), pch=c(1, 16)) Oscar. ----------------------------------------------------------------- Oscar Perpi??n Lamigueiro Dpto. Ingenier?a El?ctrica (ETSIDI-UPM) Grupo de Sistemas Fotovoltaicos (IES-UPM) URL: http://oscarperpinan.github.io Twitter: @oscarperpinan 2014-03-07 15:29 GMT+01:00 Mark Payne <markpayneatwork at gmail.com>:
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 R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
1 day later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140308/3f3e7ad4/attachment.pl>
1 day later
I am using sp 1.0-14 and lattice 0.20.27. Best, Oscar. ----------------------------------------------------------------- Oscar Perpi??n Lamigueiro Dpto. Ingenier?a El?ctrica (ETSIDI-UPM) Grupo de Sistemas Fotovoltaicos (IES-UPM) URL: http://oscarperpinan.github.io Twitter: @oscarperpinan 2014-03-08 16:43 GMT+01:00 Mark Payne <markpayneatwork at gmail.com>:
Hi Oscar, Thanks for the reply. Unfortunately your example doesn't work for me. What version of sp and lattice do you have installed? Package: sp Version: 1.0-14 Date: 2013-10-15 Package: lattice Version: 0.20-15 Date: 2013/03/24 Mark On 7 March 2014 16:25, Oscar Perpi?an <oscar.perpinan at upm.es> wrote:
Use groups instead: spplot(meuse["elev"], groups=ifelse(meuse$dist < 0.3, 1, 2), pch=c(1, 16)) Oscar. ----------------------------------------------------------------- Oscar Perpi??n Lamigueiro Dpto. Ingenier?a El?ctrica (ETSIDI-UPM) Grupo de Sistemas Fotovoltaicos (IES-UPM) URL: http://oscarperpinan.github.io Twitter: @oscarperpinan 2014-03-07 15:29 GMT+01:00 Mark Payne <markpayneatwork at gmail.com>:
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 R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo