Skip to content

how to plot different rows of a SpatialPolygonsDataFrame in trellis panels

1 message · Kent Johnson

#
On Thu, May 24, 2018 at 6:00 AM, <r-sig-geo-request at r-project.org> wrote:

            
You can do the facetting with ggplot2::geom_sf (in the dev version of
ggplot2) though I don't think it will use different coordinate ranges for
different facets:

devtools::install_github('tidyverse/ggplot2')
library(sf)
library(ggplot2)
tmp2 = st_as_sf(tmp)

ggplot(tmp2) + geom_sf(aes(fill=z)) + facet_wrap(~id)

A couple of suggestions here, using tmap or ggspatial, that look promising:
https://stackoverflow.com/questions/47678480/mapping-different-states-with-geom-sf-using-facet-wrap-and-scales-free

Kent Johnson