Skip to content

Commit 9fc31f6

Browse files
authored
Merge pull request matplotlib#19092 from jklymak/fix-use-transform-mplot3d
Fix use transform mplot3d
2 parents 4b77166 + 84665b5 commit 9fc31f6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ def draw(self, renderer):
260260
lxyz = 0.5 * (edgep1 + edgep2)
261261

262262
# A rough estimate; points are ambiguous since 3D plots rotate
263-
ax_scale = self.axes.bbox.size / self.figure.bbox.size
264-
ax_inches = np.multiply(ax_scale, self.figure.get_size_inches())
263+
reltoinches = self.figure.dpi_scale_trans.inverted()
264+
ax_inches = reltoinches.transform(self.axes.bbox.size)
265265
ax_points_estimate = sum(72. * ax_inches)
266266
deltas_per_point = 48 / ax_points_estimate
267267
default_offset = 21.

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,3 +1324,11 @@ def test_scalarmap_update(fig_test, fig_ref):
13241324
# ref
13251325
ax_ref = fig_ref.add_subplot(111, projection='3d')
13261326
sc_ref = ax_ref.scatter(x, y, z, c=c, s=40, cmap='viridis')
1327+
1328+
1329+
def test_subfigure_simple():
1330+
# smoketest that subfigures can work...
1331+
fig = plt.figure()
1332+
sf = fig.subfigures(1, 2)
1333+
ax = sf[0].add_subplot(1, 1, 1, projection='3d')
1334+
ax = sf[1].add_subplot(1, 1, 1, projection='3d', label='other')

0 commit comments

Comments
 (0)