A very simple species plotter

There are quite a few different ways to generate species distribution maps. These range upward in complexity from online mappers to ggplot in Python to GIS software.

If you’re a command-line user on Linux (or on Mac, with some extra work), you can build a very simple 1- (or 2-) species mapper with the venerable gnuplot program and a BASH script. You launch the script, choose a species (or two) from a picklist, and a map appears in a gnuplot window.

This particular solution only requires four small plain-text files:

  • the script
  • a list of species names
  • a table of species occurrences
  • a simple “basemap” file

All four files are easily editable, for example for adding new species to the picklist or new occurrence data, or changing the map’s appearance. Some examples are shown below; I use the Tasmanian one regularly in my millipede work.

Linux CLI users are welcome to email me for the how-to details.

Robert Mesibov (“datafixer”); robert.mesibov@gmail.com

Tasmania with two millipede species

Ireland with a dragonfly species

Romania with an invasive plant species

Looks cool, I associate ggplot with R much more than Python. Persionally, that’s what I’ve fallen back on when it comes to these sort of tasks for repeatabilities sake. Although I suppose a little bash script would be just as repeatable? How do you handle data cleaning steps, awk?

I was momentarily tempted to see if I could repeat this with curl and the gbif maps api:

But it’ll have to wait until another day. It’s certainly an API that I think has tremendous potential, especially if you could combine it with the stuff you can do with OSM over the API. Something I’d love to explore at some point.

Thanks for sharing!

@pieter, the ggplot “grammar” is also usable through Python, see e.g. here, and for Python users it’s an easy addition in a data analysis.

Yes, I use AWK for handling occurrence data from GBIF or other sources. For example, the Tasmanian millipede records file is a Darwin Core table I maintain, and AWK just pulls out the needed data items and gets them ready for plotting.

This very simple mapper is only for quick looks at distributions or for quickly comparing two distributions (2 species, or 2 sources for the same species). Once it’s set up in a BASH script (which includes the gnuplot configuration file) it’s fast and dependable. The Tasmanian script handles up to 4 species, but that’s about the limit for plotting clarity. For serious mapping I use either QGIS or the Tasmanian government’s online spatial data mapper, which has dozens of base layers I can use (see this plot, for example).

I haven’t tried the GBIF maps API yet, either. There are so many other mapping options available, and I prefer to curate occurrence data carefully before plotting! Also, as a CLI user I like to see what’s possible with applications with very long and continuing development histories, like gnuplot and AWK.