Canadian Climate Stripes

Its been busy around here, and summer is too nice to be blogging. But one thing I’ve been meaning to pull together for a while now is climate stripes (or bar codes) for Canadian cities.

I’ve adapted Ed Hawkins climate stripe visualizations for Canadian cities using the homogenized temperature data from Environment Canada (here) and a few lines of Python code. Each bar represents a mean annual temperature anomaly, or the departure from the overall mean, with dark blue being the coldest and dark red being the warmest.

I’ve also plotted the temperatures versus year and scaled the colour of the points the same way, and given an example for the Vancouver data. To me, this is actually more intuitive. But chacun son gout!

Vancouver, BC (-1.9 to +1.6 C, 1896 to 2017):


Same Vancouver data shown as a scatterplot:


Prince George, BC (-2.9 to 2.2 C):


Calgary, AB (-2.7 to +3.2 C, 1885 to 2017):


Toronto, ON (-3.3 to +3.3 C, 1840 to 2017):


Hay River, NT (-4.3 to +3.3 C, 1893 to 2017):


Sidney, NS (-2.3 to +2.0 C, 1870 to 2017):


3 thoughts on “Canadian Climate Stripes

  1. Hi Joseph I will be glad if you could share your python code. Thanks


    • Once you’ve imported your annual temperature series and assigned it to the variable z, you can do this:
      ## preamble
      import numpy as np
      import matplotlib.pyplot as plt
      import matplotlib as mpl

      ## calculate anomalies
      meanz = np.nanmean(z)
      zanoms = z – meanz

      ##call figure
      fig1 = plt.figure(figsize=(8,6),frameon=False)

      ## normalized anomalies
      norm = mpl.colors.Normalize(vmin=np.nanmin(zanoms),vmax=np.nanmax(zanoms))
      ax = plt.subplot(111)

      ## loop through data and plot vertical line for each year
      ## linewidth will need to be customized depending on length of dataset…
      for i in range(0,len(z)):
      if np.isnan(z[i]) == 0:
      plt.axvline(i,color =[i])),linewidth=5.5)

      ## remove axes and labels
      cur_axes = fig1.gca()


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