FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

3D axes set_aspect("equal") NotImplementedError · Issue #15382 · matplotlib/matplotlib · GitHub

Repository navigation

3D axes set_aspect("equal") NotImplementedError #15382

Closed

Description

NotImplementedError: It is not currently possible to manually set the aspect on 3D axes

Bug summary
I am making a 3d scatter plot in jupyter notebook, when I try to change the axis aspect an error raises.

Code to reproduce the error

%matplotlib notebook

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D


x, y, z = list(np.random.rand(3,10))

fig = plt.figure( figsize=(8,8))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x,y,z)
ax.set_aspect("equal")

Actual outcome

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-1-2c7b67cedd81> in <module>
     11 ax = fig.add_subplot(111, projection='3d')
     12 ax.scatter(x,y,z)
---> 13 ax.set_aspect("equal")

/hpcfs/apps/anaconda/3.7/lib/python3.7/site-packages/matplotlib/axes/_base.py in set_aspect(self, aspect, adjustable, anchor, share)
   1279         if (not cbook._str_equal(aspect, 'auto')) and self.name == '3d':
   1280             raise NotImplementedError(
-> 1281                 'It is not currently possible to manually set the aspect '
   1282                 'on 3D axes')
   1283 

NotImplementedError: It is not currently possible to manually set the aspect on 3D axes```

Expected outcome

A plot with axis ratio 1:1:1

Matplotlib version

  • Operating system: Linux CentOS
  • Matplotlib version: 3.1.0
  • Matplotlib backend: nbAgg
  • Python version: 3.7.3 (build h33d41f4_1, channel conda-forge)
  • Jupyter version: 7.8.0 (build py37h5ca1d4c_0, channel conda-forge)

I have installed python using conda, using the channel conda-forge.

Activity

  1. ImportanceOfBeingErnest commented on Oct 4, 2019

    Member

    The reason for a NotImplementedError being raised is indeed that aspect is not implemented for 3D axes. This was added deliberately in #13474 to tell people about the fact that this feature does not (yet) exist.

  2. ImportanceOfBeingErnest commented on Oct 4, 2019

    Member

    I guess it makes sense to close this. For further discussion I would invite people to participate in #1077 instead.

  3. clemens-tolboom commented on Mar 5, 2020

    I ran into this and had two options

    1. conda install matplotlib=2.2.3
    2. # ax.set_aspect('equal')
  4. ImportanceOfBeingErnest commented on Mar 5, 2020

    Member

    Option 1 (using an old version) is not sensical, because it will lead to a wrong graphical representation. Again, see #1077 for details.

  5. clemens-tolboom commented on Mar 5, 2020

    Looking at #1077 does not help when receiving old code so for this issue these options seemed useful to me to report.

    I checked with #1077 which was opened 12 Aug 2012 and closed 3 Mar 2019 so could not made sense from it either ... sorry :-(

  6. ImportanceOfBeingErnest commented on Mar 5, 2020

    Member

    ax.set_aspect('equal') produces wrong output for 3D axes. It was therefore removed. If you want to get wrong output, you can revert to an old version of matplotlib and continue using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL