Skip to content

Commit 5702e7c

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

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,3 +1011,19 @@ 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, axs = plt.subplots(1, num_plots, figsize=(4, 5),
1019+
constrained_layout=True,
1020+
subplot_kw={'projection':'3d'})
1021+
for ax in axs:
1022+
p_tri = ax.plot_trisurf(np.random.randn(5), np.random.randn(5),
1023+
np.random.randn(5))
1024+
1025+
cbar = plt.colorbar(p_tri, ax=axs, orientation='horizontal')
1026+
1027+
fig.canvas.draw()
1028+
# check that actually on the bottom
1029+
assert cbar.ax.get_position().extents[1] < 0.2

0 commit comments

Comments
 (0)