[R-sig-Geo] spplot handling of overlapping points?

Mauricio Zambrano-Bigiarini mauricio.zambrano at jrc.ec.europa.eu
Tue Mar 6 16:49:40 CET 2012


On 05/03/12 14:40, Edzer Pebesma wrote:
> This has now been changed/repared in sp on r-forge (svn), and will
> appear from sp 0.9-97 on. A test run would be:
>
> library(sp)
> xyz = data.frame(expand.grid(x=1:10,y=1:10),rnorm(100))
> coordinates(xyz)=~x+y
> spplot(xyz, cex=10)
>
> which used to plot points in value order, and does now in data record order.
>
> I put up resulting graphs, for comparison, at
> http://ifgi.uni-muenster.de/~epebe_01/xyz.html
>
> As this change may make some of your spplot's for points different, if
> there are objections against this change (which I consider an
> improvement, if not a bug fix), it is time now to let me / us know.

Would it be possible to set a degree of transparency  for the 
overlapping points in spplot ?

Thanks in advance,

Mauricio Zambrano-Bigiarini
-
=======================================================
FLOODS Action
Water Resources Unit (H01)
Institute for Environment and Sustainability (IES)
European Commission, Joint Research Centre (JRC)
webinfo    : http://floods.jrc.ec.europa.eu/
=======================================================
DISCLAIMER:
"The views expressed are purely those of the writer
and may not in any circumstances be regarded as stating
an official position of the European Commission."
=======================================================
Linux user #454569 -- Ubuntu user #17469
=======================================================
"If Columbus had turned back, no one would have blamed him.
Of course, no one would have remembered him either."
(Source Unknown)


>
> On 03/02/2012 09:03 PM, MacQueen, Don wrote:
>> I have a SpatialPointsDataFrame object in which many points are very close
>> together, such that the markers (plotting characters) tend to overlap. (Of
>> course, this depends on marker size and the scale at which I plot; if I
>> "zoom in" there is less overlap.)
>>
>> It appears that when markers overlap, spplot() places a marker associated
>> with the larger value after, and therefore on top of, a marker associated
>> with a smaller value.
>>
>> Am I correct? Or more generally, what is the algorithm that determines the
>> order in which markers are added?
>>
>>
>> I have searched ?spplot and related help pages and haven't found an
>> explanation (at least, not yet).
>>
>> I can add that I don't believe markers are placed in the order in which
>> they appear in the SpatialPointsDataFrame. I say this because when I
>> attempt to reproduce an spplot using base graphics plot() I have to sort
>> from smallest to largest value to succeed.
>>
>> I can probably provide a small reproducible example if necessary, but I'm
>> hoping it's not necessary.
>>
>> Here are my actual commands.
>>
>>    tmps is the SpatialPointsDataFrame.
>>    tmp is coordinates(tmps)
>> (they have the same number of rows in the same order)
>>
>> Note that I'm using the cuts argument to break a continuous variable
>> ('cpm2') into bins. I have carefully matched the colors in tmps$col2 with
>> the cbin.cols object passed to spplot(), and the break points for the bin
>> boundaries, so I believe that everything else that could affect the final
>> appearance, other than the order in which the markers are placed, is
>> controlled.
>>
>> #1 using spplot
>> spplot(tmps,c('cpm2'),
>>     key.space='right',
>>     legendEntries=cbin.lbls,
>>     cuts=cbin.brks,
>>     col.regions=cbin.cols,
>>     cex=0.4)
>>
>> #2 using base graphics
>> plot(tmp[,1],tmp[,2], asp=1, cex=0.6, pch=16, col=tmps$col2)
>>
>>
>>
>> Thanks
>> -Don
>>
>


-



More information about the R-sig-Geo mailing list