Skip to content

Commit 05f14ce

Browse files
committed
TST: add test that colorbar goes on bottom
1 parent d4857ef commit 05f14ce

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,3 +1011,21 @@ def test_equal_box_aspect():
10111011
ax.set_zlim3d(XYZlim)
10121012
ax.axis('off')
10131013
ax.set_box_aspect((1, 1, 1))
1014+
1015+
1016+
def test_colorbar_pos():
1017+
num_plots = 2
1018+
fig = plt.figure(figsize=plt.figaspect(1 / num_plots),
1019+
constrained_layout=True)
1020+
ax_l = []
1021+
for idx in range(num_plots):
1022+
ax = fig.add_subplot(1, num_plots, idx+1, projection='3d')
1023+
p_tri = ax.plot_trisurf(np.random.randn(5), np.random.randn(5), np.random.randn(5),
1024+
cmap=plt.cm.coolwarm)
1025+
ax_l.append(ax)
1026+
1027+
cbar = plt.colorbar(p_tri, ax=ax_l, orientation='horizontal')
1028+
1029+
fig.canvas.draw()
1030+
# check that actually on the bottom
1031+
assert cbar.ax.get_position().extents[1] < 0.2

0 commit comments

Comments
 (0)