It is often useful to contrast data by displaying multiple plots next to each other. We have seen that pandas does this automatically for several types of graphs. It is also possible to manually render multiple plots on the same canvas.
To render multiple subplots on a canvas with matplotlib, make multiple calls to plt.subplot2grid(). Each time pass the size of the grid the subplot is to be located on (shape=(height, width)) and the location on the grid of the upper-left location of the subplot (loc=(row, column)). The dimensions are in the overall number of columns and not pixels.
The return value from each call to plt.subplot2grid() is a different AxesSubplot object that can be used to specify the position of the rendering of the subplot.
The following code demonstrates this by creating a plot based on two rows and one column...