April 2018
Beginner to intermediate
300 pages
7h 34m
English
While plt.subplots() provides a handy way to create grids of same-sized subplots, at times we may need to combine subplots of different sizes in a group. This is when plt.subplot2grid() comes into use.
plt.subplot2grid() takes in three to four parameters. The first tuple specifies the overall dimensions of the grid. The second tuple determines where in the grid the top left corner of a subplot starts. Finally we describe the subplot dimensions using the rowspan and colspan arguments.
Here is a code example to showcase the usage of this function:
import matplotlib.pyplot as pltaxarr = []axarr.append(plt.subplot2grid((3,3),(0,0)))axarr.append(plt.subplot2grid((3,3),(1,0)))axarr.append(plt.subplot2grid((3,3),(0,2), ...
Read now
Unlock full access