Session Ready
Exercise

Creating small multiples with plt.subplots

Small multiples are used to plot several datasets side-by-side. In Matplotlib, small multiples can be created using the plt.subplots() function. The first argument is the number of rows in the array of Axes objects generate and the second argument is the number of columns. In this exercise, you will use the Austin and Seattle data to practice creating and populating an array of subplots.

The data is given to you in DataFrames: seattle_weather and austin_weather. These each have a MONTH column and MLY-PRCP-NORMAL (for average precipitation), as well as MLY-TAVG-NORMAL (for average temperature) columns. In this exercise, you will plot in a separate subplot the monthly average precipitation and average temperatures in each city.

Instructions
100 XP
  • Create a Figure and an array of subplots with 2 rows and 2 columns.
  • Addressing the top left Axes as index 0, 0, plot the Seattle precipitation.
  • In the top right (index 0,1), plot Seattle temperatures.
  • In the bottom left (1, 0) and bottom right (1, 1) plot Austin precipitations and temperatures.