How it works...

Here is the explanation of the preceding code.

This is the first figure:

  • fig, (ax1, ax2, ax3) = plt.subplots(1,3, figsize=(15,5)) defines the figure and three axes in a row.
  • sns.heatmap(sales, annot=True, fmt='.0f',linewidths=.5, cmap="YlGnBu", ax=ax1) plots the heatmap:
    • sales is the quarter and item sales data frame.
    • annot=True specifies to display the actual numbers on the plot.
    • fmt='.0f' specifies that the numbers should be displayed in integer format without any decimal values.
    • linewidths=0.5 specifies that all the rows and columns should be plotted with lines of this width.
    • cmap=" YlGnBu" specifies the predefined colormap.
    • ax=ax1 specifies the axes on which this graph is to be plotted.
  • ax1.set_title('Using pre-defined ...

Get Matplotlib 3.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.