October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following code block defines two 3 x 3 grids using GridSpec(). In grid1, we plot four graphs, each with different widths and heights. In grid2, we plot nine graphs, using width and height ratios, in such a way that the height is the same for all the graphs in a row, whereas the width is the same for all the graphs in a column:
np.random.seed(19681211)
plt.style.use('seaborn')
fig = plt.figure(figsize=(14,10))gs1 = GridSpec(ncols=3, nrows=3, left=0.05, right=0.5, wspace=0.2, hspace=0.1)
ax1 = fig.add_subplot(gs1[0, 0])
Read now
Unlock full access