Session Ready
Exercise

Plotting an inset view

Remember, rather than comparing plots with subplots or overlayed plots, you can generate an inset view directly using plt.axes(). In this exercise, you'll reproduce two of the time series plots from the preceding two exercises. Your figure will contain an inset plot to highlight the dramatic changes in AAPL stock price between November 2007 and April 2008 (as compared to the 11 years from 2001 to 2011).

Instructions
100 XP
  • Extract a slice of series aapl from November 2007 to April 2008 inclusive. This has been done for you.
  • Plot the entire series aapl.
  • Create a set of axes with lower left corner (0.25, 0.5), width 0.35, and height 0.35. Pass these four coordinates to plt.axes() as a list (all in units relative to the figure dimensions).
  • Plot the sliced view in the current axes in 'red'.