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

Thierry Onkelinx thierry.onkelinx at inbo.be
Thu Dec 8 14:19:41 CET 2016


Hi Barry,

xlim(c(-100, 100)) is the ggplot shorthand for scale_x_continuous(limits =
c(-100, 100)) This sets x coordinates outside the limits to NA. The
solution is to use coord_cartesian(xlim = c(-100, 100))

See http://rpubs.com/INBOstats/zoom_in for more details and some examples.

Best regards,


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2016-12-08 12:19 GMT+01:00 Barry Rowlingson <b.rowlingson at lancaster.ac.uk>:

> 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
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list