Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register Axes3D along with other projections #2600

Closed
wants to merge 1 commit into from

Conversation

megies
Copy link
Contributor

@megies megies commented Nov 18, 2013

The docs state the following for mplot3d as preferred usage:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

Because Axes3D is only registered as a projection in mpl_toolkits.mplot3d.axes3d one has to import from there even though the module is otherwise integrated rather seamlessly. It feels a bit odd to have an unused import as the preferred usage.

How about registering the projection earlier, within matplotlib, thus obviating this import? As far as I can see mplot3d is always there when matplotlib is installed (I put an except ImportError anyway to make double sure to not break anything). Well.. just cosmetics, I guess, so feel free to just close.

If this gets a thumbs up, I'll also change the docs accordingly.

@mdboom
Copy link
Member

mdboom commented Nov 18, 2013

As mplot3d is a rather large chunk of code that isn't always used, I'd rather see this import happen dynamically when it's actually required. That will require some changes to the projection registration mechanism -- to that you could map a name, 3d, to the name of a class mpl_toolkits.mplot3d.Axes3D as a string, that is then looked up and imported at runtime.

@megies
Copy link
Contributor Author

megies commented Nov 18, 2013

Ok, I'll close this for now then. That's a major change I can not promise to handle soonish.

@megies megies closed this Nov 18, 2013
@anntzer
Copy link
Contributor

anntzer commented Mar 4, 2014

It may be worth mentioning in the docs that the import is required for projection="3d" to work (as this is a non-trivial side-effect).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants