Open dblodgett-usgs opened 1 year ago
In my opinion, all of the ones below are good options:
A while back, I implemented a client with prettymapr: https://github.com/DOI-USGS/nhdplusTools/blob/main/R/plot_nhdplus.R#L161 -- in conversation with @paleolimbot it seems like moving away from that will be wise. I really like the simplicity of it. -- it's just a set of utilities to make a map with base graphics where you can layer your base plot calls on top of an alreaddy initialized map.
It seems like {mapsf} is close to that but implements a fairly different API. Maybe {tmap} is the ticket to stay in base R graphics?
Hello, mapsf creates maps in base graphics. You can combine mf_map() calls with plot(st_geometry()) calls without problems. The theming part of the package sets specific margins and default colours, and that's what is used by mf_map() and other functions. This part could be more explicit in future versions (maybe through the use of options()). Anyway, I'm open to discussion in order to make the package more reusable.
Thanks @rCarto -- I think a rudimentary {mapsf}
with {maptiles}
will probably be the most 1:1 for what I've been doing with {rosm}
and {prettymapr}
. I'll do a little experimentation and drop a reference to my progress here.
Out of curiosity, what's the design distinction between tmap and mapsf that would help me and others understand why to pursue one or the other?
Yes, prettymapr will be mothballed soon. The rosm package, because of its use in ggspatial, will be rewritten in the next month or so to remove the rgdal dependency (but all of tmap, mapsf, and maptiles are awesome and you should use them!).
Out of curiosity, what's the design distinction between tmap and mapsf that would help me and others understand why to pursue one or the other?
tmap
, ggplot2
and ggspatial
all build on package grid
: they incrementally build a plot object, and plot it in the final stage, after which you cannot easily add things to that plot. mapsf
(and e.g. sf::plot.sf
) use the base plot commands from package base
(or graphics
), which works with sequential calls to routines that plot things to the graphics device sequentially. Using the latter approach it is easier to customize plots by adding things e.g. by calls to points()
, text()
, lines()
, arrows()
and so on, but it is practically impossible to create (good) facet plots using the latter approach. I think that in addition to having a native NA
, facet plots are the main reason why R stands out in the data science landscape.
Perfect. Thanks for that, @edzer
Scanning the r-spatial list we have a clear set of slippy map community packages, but what do people recommend for static mapping? Tmap? Ggmap? Mapsf? Other? There are a few options out there and I’m wondering if one is more defacto supported as a long term dependency for r-spatial?