[R-sig-Geo] Spplot: Specifying individual point symbols

Oscar Perpiñan oscar.perpinan at upm.es
Mon Mar 10 10:03:29 CET 2014


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
>



More information about the R-sig-Geo mailing list