|
23 | 23 | pcm = ax.pcolormesh(np.random.random((20, 20)) * (col + 1),
|
24 | 24 | cmap=cmaps[col])
|
25 | 25 | fig.colorbar(pcm, ax=ax)
|
26 |
| -plt.show() |
27 | 26 |
|
28 | 27 | ######################################################################
|
29 | 28 | # The first column has the same type of data in both rows, so it may
|
|
38 | 37 | pcm = ax.pcolormesh(np.random.random((20, 20)) * (col + 1),
|
39 | 38 | cmap=cmaps[col])
|
40 | 39 | fig.colorbar(pcm, ax=axs[:, col], shrink=0.6)
|
41 |
| -plt.show() |
42 | 40 |
|
43 | 41 | ######################################################################
|
44 | 42 | # Relatively complicated colorbar layouts are possible using this
|
|
53 | 51 | fig.colorbar(pcm, ax=[axs[0, 2]], location='bottom')
|
54 | 52 | fig.colorbar(pcm, ax=axs[1:, :], location='right', shrink=0.6)
|
55 | 53 | fig.colorbar(pcm, ax=[axs[2, 1]], location='left')
|
56 |
| -plt.show() |
57 | 54 |
|
58 | 55 | ######################################################################
|
59 | 56 | # Colorbars with fixed-aspect-ratio axes
|
|
75 | 72 | ax.set_aspect(1/2)
|
76 | 73 | if row == 1:
|
77 | 74 | fig.colorbar(pcm, ax=ax, shrink=0.6)
|
78 |
| -plt.show() |
79 | 75 |
|
80 | 76 | ######################################################################
|
81 | 77 | # One way around this issue is to use an `.Axes.inset_axes` to locate the
|
|
94 | 90 | else:
|
95 | 91 | ax.set_aspect(1/2)
|
96 | 92 | if row == 1:
|
97 |
| - cax = ax.inset_axes([1.04, 0.2, 0.05, 0.6], transform=ax.transAxes) |
| 93 | + cax = ax.inset_axes([1.04, 0.2, 0.05, 0.6]) |
98 | 94 | fig.colorbar(pcm, ax=ax, cax=cax)
|
| 95 | + |
99 | 96 | plt.show()
|
0 commit comments