Fix pathpatch3d_demo.py on Python 3 #981

Merged
merged 2 commits into from Jul 18, 2012

Projects

None yet

3 participants

@cgohlke

No description provided.

@pelson pelson and 2 others commented on an outdated diff Jun 30, 2012
examples/mplot3d/pathpatch3d_demo.py
@@ -1,14 +1,13 @@
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, PathPatch
-from mpl_toolkits.mplot3d import Axes3D
@pelson
pelson Jun 30, 2012

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

@cgohlke
cgohlke Jun 30, 2012

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

@pelson
pelson Jun 30, 2012

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.

@cgohlke
cgohlke Jun 30, 2012

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

@WeatherGod
WeatherGod Jun 30, 2012

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.

@WeatherGod
WeatherGod Jun 30, 2012

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
Matplotlib Developers member

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

@cgohlke
  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
Matplotlib Developers 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 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