1 import matplotlib.pyplot as plt
3 import matplotlib.gridspec as gridspec
5 fig = plt.figure(tight_layout=True)
6 gs = gridspec.GridSpec(2, 3)
8 ax = fig.add_subplot(gs[0, :])
9 ax.plot(np.arange(0, 1e6, 1000))
10 ax.set_ylabel('YLabel0')
11 ax.set_xlabel('XLabel0')
14 ax = fig.add_subplot(gs[1, i])
15 ax.plot(np.arange(1., 0., -0.1) * 2000.,
16 np.arange(1., 0., -0.1))
17 ax.set_ylabel('YLabel1 %d' % i)
18 ax.set_xlabel('XLabel1 %d' % i)
20 for tick in ax.get_xticklabels():
23 # Makes sure that axes labels are aligned with each other
24 # same as fig.align_xlabels(); fig.align_ylabels()