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

Michael Sumner mdsumner at gmail.com
Thu Dec 8 12:44:30 CET 2016


On Thu, 8 Dec 2016 at 22:19 Barry Rowlingson <b.rowlingson at lancaster.ac.uk>
wrote:

> 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.
>
>
I suspect it's related to what's happening here too,

https://github.com/hrbrmstr/ggalt/issues/21

 there are limits to what you can do without having perfectly stretchable
infinitely precise edges (but then you are Mike Bostock:
https://bost.ocks.org/mike/example/ with the cunning trickery of ArcInfo
vectors brought into the web-age )

Sometimes you do want non-topological clipping though, it was a saviour
when I wanted this map:

https://github.com/mdsumner/tissot#som

It was good enough for the task, which is a value of "works". To me this is
where the user should be allowed to learn how things work. The faster they
can get to the "not work" result, the faster they can decide on the right
way to get their job done.

There are plenty of things that also can't be done using the proper tools
that "always work". I also say "Gah!" and sometimes more descriptive
expletives, and use whatever I need to finish it. That's good right?

I'll add this to the here-be-dragons-in-the-fish-soup list. Thanks!

Cheers, Mike.



> 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
>
-- 
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list