[R-sig-Geo] spplot handling of overlapping points?
macqueen1 at llnl.gov
Mon Mar 5 16:36:01 CET 2012
I think you've done the right thing -- and thank you for the quick
Ironically, in the application that brought this up plotting higher values
on top was convenient, because higher values are of more interest.
However, I can still have higher values on top simply by sorting before
plotting. The user now has more control, and this is good.
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
On 3/5/12 5:40 AM, "Edzer Pebesma" <edzer.pebesma at uni-muenster.de> 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:
>xyz = data.frame(expand.grid(x=1:10,y=1:10),rnorm(100))
>which used to plot points in value order, and does now in data record
>I put up resulting graphs, for comparison, at
>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.
>On 03/02/2012 09:03 PM, MacQueen, Don wrote:
>> I have a SpatialPointsDataFrame object in which many points are very
>> together, such that the markers (plotting characters) tend to overlap.
>> 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
>> with the larger value after, and therefore on top of, a marker
>> with a smaller value.
>> Am I correct? Or more generally, what is the algorithm that determines
>> 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
>> 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
>> the cbin.cols object passed to spplot(), and the break points for the
>> boundaries, so I believe that everything else that could affect the
>> appearance, other than the order in which the markers are placed, is
>> #1 using spplot
>> #2 using base graphics
>> plot(tmp[,1],tmp[,2], asp=1, cex=0.6, pch=16, col=tmps$col2)
>Institute for Geoinformatics (ifgi), University of Münster
>Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
>8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
>http://www.52north.org/geostatistics e.pebesma at wwu.de
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
More information about the R-sig-Geo