8000 Merge pull request #17515 from tacaswell/fix_3D_tight_aspect · matplotlib/matplotlib@bbb4856 · GitHub
[go: up one dir, main page]

Skip to content

Commit bbb4856

Browse files
authored
Merge pull request #17515 from tacaswell/fix_3D_tight_aspect
FIX: add set_box_aspect, improve tight bounding box for Axes3D + fix bbox_inches support with fixed box_aspect
2 parents 8d49327 + 8ee34a9 commit bbb4856

File tree

9 files changed

+693
-23
lines changed

9 files changed

+693
-23
lines changed

doc/users/next_whats_new/2019-03-25-mplot3d-projection.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
Plots made with :class:`~mpl_toolkits.mplot3d.axes3d.Axes3D` were previously
55
stretched to fit a square bounding box. As this stretching was done after
66
the projection from 3D to 2D, it resulted in distorted images if non-square
7-
bounding boxes were used.
7+
bounding boxes were used. As of 3.3, this no longer occurs.
88

9-
As of this release, this no longer occurs.
9+
Currently, modes of setting the aspect (via
10+
`~mpl_toolkits.mplot3d.axes3d.Axes3D.set_aspect`) in data space are
11+
not supported for Axes3D but may be in the future. If you want to
12+
simulate having equal aspect in data space, set the ratio of your data
13+
limits to match the value of `~.get_box_aspect`. To control these
14+
ratios use the `~mpl_toolkits.mplot3d.axes3d.Axes3D.set_box_aspect`
15+
method which accepts the ratios as a 3-tuple of X:Y:Z. The default
16+
aspect ratio is 4:4:3.

lib/matplotlib/axes/_base.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,10 +1339,6 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
13391339
if cbook._str_equal(aspect, 'equal'):
13401340
aspect = 1
13411341
if not cbook._str_equal(aspect, 'auto'):
1342-
if self.name == '3d':
1343-
raise NotImplementedError(
1344-
'It is not currently possible to manually set the aspect '
1345-
'on 3D axes')
13461342
aspect = float(aspect) # raise ValueError if necessary
13471343

13481344
if share:

0 commit comments

Comments
 (0)
0