Mapping Global Earthquake Activity: A matplotlib Basemap tutorial


This tutorial has been updated and moved to


If you are a python programmer, you have probably heard of matplotlib.  It’s a wonderful tool for data visualization work, but it can be confusing to work with at first.  This tutorial introduces the Basemap library, which can be used to create maps and plot geographical datasets.

The main goal of this tutorial is to help you get comfortable making maps of geographical data.  If you follow along with the tutorial, you will end up making this map:

A map of the world' most recent earthquakes, of magnitude 1.0 or greater.

A map of the world’ most recent earthquakes, of magnitude 1.0 or greater. The magnitude of each earthquake is represented by dot size and color.

It takes fewer than 50 lines of code to generate this map from a raw dataset!  This tutorial concludes with a listing of datasets to explore.

Tutorial Contents

One of my goals in writing this tutorial is to help high school students apply their interest in programming to their core academic subjects.  If you are a high school student, please consider using this technique to create a visualization for one of your classes, that none of your non-programming peers could even consider making.  You will probably impress your teacher, you will get to use programming in one of your required classes, and you will certainly learn some  interesting things in the process.

Whatever your motivations are for learning about mapping, I hope this tutorial helps you understand how to use matplotlib’s Basemap package a little better.  Thank you to the folks who have made these resources available to all of us!

Next:  Installing matplotlib and Basemap


About ehmatthes

Teacher, hacker, new dad, outdoor guy
This entry was posted in programming and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s