Jeremy Yoder wrote a wrote a post on The Molecular Ecologist about plotting location data in ggplot. It is a very informative post. However, I disagree with one (minor) aesthetic choice. The species in his figure have different colors and shapes. I am very opinionated about data visualization, all my friends can attest. My opinion follows Stephen Few’s “Practical Rules for Using Color in Charts” “Use different colors only when they correspond to differences of meaning in the data.”
Jeremy Yoder’s plot from Making Maps in R, volume 2: ggplots. Notice the colors and shapes vary by species.
We can apply Few’s rule to this plot, “Use different colors [and shapes] only when they correspond to differences of meaning in the data.” Conforming to this rule, below is my attempt.
My attempt at duplicating the map. I’ve decided to use only color to represent the differences in species.
Here is the code To create my figure. For more information about the data, and more in depth instruction on using ggplot and the functions to convert the distribution locations to polygons refer to Jeremy’s post.
My go to packages for plotting location data is leaflet. I use leaflet because adding a basemap is easy and the interactivity makes it easy for exploring the exact locations of data. There are several instances that the popup markers have helped me QA/QC my data. Below is the code to reproduce the plot with leaflet. I find using geojsons to be the easiest way to add polygons to leaflet maps.
Leaflet version of the ggplot map
It is entirely possible that the changing the shape and color in the original post is to show that it can be done. I undertook this as an exercise to practice my R mapping skills and present an alternative solution to mapping in R using leaflet.