Climate Heatmaps Made Easy

With sns.

lineplot() you plotted the Temperature data pretty much like you'd do with the standard plt.

plot() from Matplotlib while the red and blue shaded regions represent (with a poetic license) the Medieval Warm Period and the Little Ice Age with the help from axvspan().

The set_xlabel() and set_ylabel() functions are familiar with anyone with a contact with Matplotlib, but here you saw they also work well with LaTeX for the $degree$ symbol.

But enough of Hockey, where are the Stripes?Paleoclimate StripesLooking at the original Warming Stripes as a Heatmap the graph doesn’t show any color bar nor axis labels and ticks, so it’s important to supress these to keep the fidelity of your own stripes.

For that, Seaborn provides lots of options enough to make a good approximation.

One thing to pay attention is the fact that Seaborn requires a 2D array as input data, while your time series is a simple 1D array:One way to get around this problem is to use NumPy and make a new dimension with np.

newaxis.

With this solved it's easy to make your own Stripes:Using sns.

heatmap() your arguments were:data: the mbh99 temperature time seriescmap and cbar: the seismic colormap from the Matplotlib Library (other cool ones are: RdYlBu_r, seismic, coolwarm, bwr, RdBu_r) and False to supress the colorbarvmin, vmax and center: the minimum (-.

4) and maximum (.

1) limits to plot the colors, while the red and blue diverge at 0.

xticklabels and yticklabels: all False to make just the stripes visibleThere you are, your own Warming Stripes.

Quite easy, isn’t it?ConclusionPaleoclimatology is the study of distant time’s climate, from a few centuries ago to the first days of Earth.

NCEI’s Paleoclimate Database allows anyone to download several datasets from different studies, such as Mann, Bradley and Hughes (1999) but you can get data from many others as well.

With a little of Pandas and Seaborn you can read data and make Heatmaps for any time series you are interested, such as the one you used here, and make your own version of the Warming Stripes (plus many other stuff as well).

Have fun!PS: you can get the source code and the data easily right here.

References[1] Mann, M.

E.

, Bradley, R.

S.

and Hughes, M.

K.

(1999).

Northern hemisphere temperatures during the past millennium: inferences, uncertainties, and limitations.

Geophysical research letters, 26(6), 759–762.

.. More details

Leave a Reply