GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #13474 from dstansby/3d-equal-aspect · matplotlib/matplotlib@f8f6fdf

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api/next_api_changes
    • 2019-02-20-DS.rst
  • lib
    • matplotlib/axes
      • _base.py
    • mpl_toolkits/tests
      • test_mplot3d.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/next_api_changes/2019-02-20-DS.rst‎

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Equal aspect axes for 3D plots disabled
2+
```````````````````````````````````````
3+
4+
Setting the aspect on 3D axes previously returned non-sensical
5+
results (e.g. see https://github.com/matplotlib/matplotlib/issues/1077).
6+
Calling ``ax.set_aspect('equal')`` or ``ax.set_aspect(num)``
7+
on a 3D axes now raises a ``NotImplementedError``.
Collapse file

‎lib/matplotlib/axes/_base.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,11 +1271,18 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
12711271
if not (cbook._str_equal(aspect, 'equal')
12721272
or cbook._str_equal(aspect, 'auto')):
12731273
aspect = float(aspect) # raise ValueError if necessary
1274+
1275+
if (not cbook._str_equal(aspect, 'auto')) and self.name == '3d':
1276+
raise NotImplementedError(
1277+
'It is not currently possible to manually set the aspect '
1278+
'on 3D axes')
1279+
12741280
if share:
12751281
axes = set(self._shared_x_axes.get_siblings(self)
12761282
+ self._shared_y_axes.get_siblings(self))
12771283
else:
12781284
axes = [self]
1285+
12791286
for ax in axes:
12801287
ax._aspect = aspect
12811288

Collapse file

‎lib/mpl_toolkits/tests/test_mplot3d.py‎

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/tests/test_mplot3d.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
import numpy as np
1212

1313

14+
def test_aspect_equal_error():
15+
fig = plt.figure()
16+
ax = fig.add_subplot(111, projection='3d')
17+
with pytest.raises(NotImplementedError):
18+
ax.set_aspect('equal')
19+
20+
1421
@image_comparison(baseline_images=['bar3d'], remove_text=True)
1522
def test_bar3d():
1623
fig = plt.figure()

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.