GridSpec() is another powerful feature for complex figure layouts. plt.subplot() and plt.subplot2grid() add plots one at a time after instantiating the figure, and figure layout is specified in the number of rows and columns in each subplot, followed by the sequence number of the plot from left to right and top to bottom. But plt.subplots() defines the entire figure layout, in terms of number of rows and columns, in one go, then each plot/axes is accessed using the corresponding index. GridSpec() enables multiple grids to be created in the figure layout, with each grid similar to plt.subplots(). In this recipe, we will learn about how to use GridSpec() and how GridSpec() keyword parameters can be used with plt.subplots().





















































