Session Ready
Exercise

Using subplot() (1)

The command plt.axes() requires a lot of effort to use well because the coordinates of the axes need to be set manually. A better alternative is to use plt.subplot() to determine the layout automatically.

In this exercise, you will continue working with the same arrays from the previous exercises: year, physical_sciences, and computer_science. Rather than using plt.axes() to explicitly lay out the axes, you will use plt.subplot(m, n, k) to make the subplot grid of dimensions m by n and to make the kth subplot active (subplots are numbered starting from 1 row-wise from the top left corner of the subplot grid).

Instructions
100 XP
  • Use plt.subplot() to create a figure with 1x2 subplot layout & make the first subplot active.
  • Plot the percentage of degrees awarded to women in Physical Sciences in blue in the active subplot.
  • Use plt.subplot() again to make the second subplot active in the current 1x2 subplot grid.
  • Plot the percentage of degrees awarded to women in Computer Science in red in the active subplot.