8

I have a tally by zip code which is a lot of polygons to plot (30,357 to be precise). Consequently when I pdf the spplot all I see are the borders not the choropleth interiors.

Therefore, I'd like to turn off plotting the borders, or at least be able to make them much, much thinner. However, digging around in ?spplot and its various offshoots (the panel function, levelplot, etc.) have come up empty.

Here's an example to work with (the borders aren't that prominent here but they would be given a bajillion polygons):

library(sp)
Srs1 = Polygons(list(Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2)))), "s1")
Srs2 = Polygons(list(Polygon(cbind(c(5,4,2,5),c(2,3,2,2)))), "s2")

SpDF <- SpatialPolygonsDataFrame( SpatialPolygons(list(Srs1,Srs2)), 
            data.frame( z=1:2, row.names=c("s1","s2") ) )
spplot(SpDF, zcol="z")

spplot

Josh O'Brien
  • 159,210
  • 26
  • 366
  • 455
Ari B. Friedman
  • 71,271
  • 35
  • 175
  • 235
  • I've incorporated this answer and a few other examples of choropleth coloring into [this gis.SE question](http://gis.stackexchange.com/questions/36877/how-do-i-change-the-polygon-fill-color-and-border-color-for-spatialpolygons-obje/36878#36878). – Ari B. Friedman Oct 16 '12 at 20:51

1 Answers1

13

It looks like you just need to set col="transparent", like so:

spplot(SpDF, zcol="z", col="transparent")

enter image description here

Josh O'Brien
  • 159,210
  • 26
  • 366
  • 455
  • 4
    `col=NA` will save your fingers 11 keystrokes :) Also, don't use the default colour palette or you'll have white polygons on a white background... – Spacedman Oct 02 '12 at 06:47
  • I'd assumed `col` was the color of the interior, but of course it makes total sense it'd be the borders. Thanks! – Ari B. Friedman Oct 02 '12 at 11:51