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

Fix pathpatch3d_demo.py on Python 3 #981

Merged
merged 2 commits into from Jul 18, 2012
Merged

Fix pathpatch3d_demo.py on Python 3 #981

merged 2 commits into from Jul 18, 2012

Conversation

cgohlke
Copy link
Contributor

@cgohlke cgohlke commented Jun 30, 2012

No description provided.

@@ -1,14 +1,13 @@
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, PathPatch
from mpl_toolkits.mplot3d import Axes3D
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this needed to register the 3d projection?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used anywhere in the file. Does the import have a side effect?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From memory yes. I think it registers the projection with matplotlib. Presumably the code still runs as there are other 3d imports, but this particular import should remain and should be explicitly commented as to why it is there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, Thanks. I'll work on the remaining issues tomorrow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is needed there. By importing Axes3D, the Axes3D class gets registered with the rest of matplotlib and it allows for more seamless integration with the rest of mpl. This is fully documented in the mplot3d documentation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, yes, because of the other mplot3d imports there, removing that line still works, but I would rather keep everything consistent with the documentation.

@pelson
Copy link
Member

pelson commented Jul 17, 2012

Out of interest, what was broken in Python 3 with this example?

@cgohlke
Copy link
Contributor Author

cgohlke commented Jul 17, 2012

  File "pathpatch3d_demo.py", line 9
    def text3d(ax, (x, y, z), s, zdir="z", size=None, angle=0, usetex=False,
                   ^
SyntaxError: invalid syntax

@WeatherGod
Copy link
Member

heh, never knew it was possible to do that. Looks like 3.0 removed that feature. Good thing I never learned that hideous syntax.

WeatherGod added a commit that referenced this pull request Jul 18, 2012
Fix pathpatch3d_demo.py on Python 3
@WeatherGod WeatherGod merged commit 352467c into matplotlib:master Jul 18, 2012
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