diff --git a/lib/mpl_toolkits/mplot3d/axis3d.py b/lib/mpl_toolkits/mplot3d/axis3d.py index cfd66e8944b6..5fe88350d800 100644 --- a/lib/mpl_toolkits/mplot3d/axis3d.py +++ b/lib/mpl_toolkits/mplot3d/axis3d.py @@ -260,8 +260,8 @@ def draw(self, renderer): lxyz = 0.5 * (edgep1 + edgep2) # A rough estimate; points are ambiguous since 3D plots rotate - ax_scale = self.axes.bbox.size / self.figure.bbox.size - ax_inches = np.multiply(ax_scale, self.figure.get_size_inches()) + reltoinches = self.figure.dpi_scale_trans.inverted() + ax_inches = reltoinches.transform(self.axes.bbox.size) ax_points_estimate = sum(72. * ax_inches) deltas_per_point = 48 / ax_points_estimate default_offset = 21. diff --git a/lib/mpl_toolkits/tests/test_mplot3d.py b/lib/mpl_toolkits/tests/test_mplot3d.py index 3bf3d3be5b0d..60436bd6bb93 100644 --- a/lib/mpl_toolkits/tests/test_mplot3d.py +++ b/lib/mpl_toolkits/tests/test_mplot3d.py @@ -1324,3 +1324,11 @@ def test_scalarmap_update(fig_test, fig_ref): # ref ax_ref = fig_ref.add_subplot(111, projection='3d') sc_ref = ax_ref.scatter(x, y, z, c=c, s=40, cmap='viridis') + + +def test_subfigure_simple(): + # smoketest that subfigures can work... + fig = plt.figure() + sf = fig.subfigures(1, 2) + ax = sf[0].add_subplot(1, 1, 1, projection='3d') + ax = sf[1].add_subplot(1, 1, 1, projection='3d', label='other')