Without sharex=True, sharey=True you will get:

With it you should get it better:
fig, axes2d = plt.subplots(nrows=3, ncols=3, sharex=True, sharey=True, figsize=(6,6)) for i, row in enumerate(axes2d): for j, cell in enumerate(row): cell.imshow(np.random.rand(32,32)) plt.tight_layout()

But if you want to add additional labels, you should add them only to the boundary graphs:
fig, axes2d = plt.subplots(nrows=3, ncols=3, sharex=True, sharey=True, figsize=(6,6)) for i, row in enumerate(axes2d): for j, cell in enumerate(row): cell.imshow(np.random.rand(32,32)) if i == len(axes2d) - 1: cell.set_xlabel("noise column: {0:d}".format(j + 1)) if j == 0: cell.set_ylabel("noise row: {0:d}".format(i + 1)) plt.tight_layout()

Adding a label for each chart will ruin it (maybe there is a way to automatically detect duplicate labels, but I don't know about that).
Piotr Migdal May 13 '14 at 18:21 2014-05-13 18:21
source share