Skip to content

FIX: use internal _set_postion, not external #18038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def apply_aspect(self, position=None):
box_aspect = 1
pb = position.frozen()
pb1 = pb.shrunk_to_aspect(box_aspect, pb, fig_aspect)
self.set_position(pb1.anchored(self.get_anchor(), pb), 'active')
self._set_position(pb1.anchored(self.get_anchor(), pb), 'active')

@artist.allow_rasterization
def draw(self, renderer):
Expand Down
16 changes: 16 additions & 0 deletions lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,3 +1011,19 @@ def test_equal_box_aspect():
ax.set_zlim3d(XYZlim)
ax.axis('off')
ax.set_box_aspect((1, 1, 1))


def test_colorbar_pos():
num_plots = 2
fig, axs = plt.subplots(1, num_plots, figsize=(4, 5),
constrained_layout=True,
subplot_kw={'projection': '3d'})
for ax in axs:
p_tri = ax.plot_trisurf(np.random.randn(5), np.random.randn(5),
np.random.randn(5))

cbar = plt.colorbar(p_tri, ax=axs, orientation='horizontal')

fig.canvas.draw()
# check that actually on the bottom
assert cbar.ax.get_position().extents[1] < 0.2