[R-sig-Geo] Plotting simple features sf with ggplot2

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Dec 8 12:19:06 CET 2016


On Wed, Dec 7, 2016 at 10:43 PM, Michael Sumner <mdsumner at gmail.com> wrote:

> I think there is now a majority opinion that fortify is not such a good
> idea for simple feature (or in general: spatial) geometries.
>
>
> It's not a great idea, but you can do it and it already works.

It works, for some values of "works". There appears to be serious
problems if polygons are clipped using xlim and ylim. I have a feeling
I've seen this before, and possibly may even have reported it, but the
problem still exists. I have a vaguer feeling Hadley Wickham may have
even been made aware, but its also possible that I just noticed it,
went "Gah!" and carried on using base graphics without telling anyone.

Anyway, hopefully reproducible examples here. The columbus example is
especially gross:

https://gist.github.com/barryrowlingson/79f0964777496e78c57d6be825ea68f3

It seems that if a fortified data set has points that are outside the
bounding box, they are removed and then the polygon drawn from the
remaining points. This can seriously mash features, as seen in the
gist example.

But maybe its my R version (3.3.1) or my ggplot2 version (updated just
now from CRAN) or grid graphics package or graphics device?

Barry



More information about the R-sig-Geo mailing list