Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 352467c

Browse files
committed
Merge pull request #981 from cgohlke/patch-17
Fix pathpatch3d_demo.py on Python 3
2 parents 1418e4a + 27839d1 commit 352467c

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

examples/mplot3d/pathpatch3d_demo.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import matplotlib.pyplot as plt
22
from matplotlib.patches import Circle, PathPatch
3+
# register Axes3D class with matplotlib by importing Axes3D
34
from mpl_toolkits.mplot3d import Axes3D
45
import mpl_toolkits.mplot3d.art3d as art3d
56
from matplotlib.text import TextPath
67
from matplotlib.transforms import Affine2D
78

89

9-
def text3d(ax, (x, y, z), s, zdir="z", size=None, angle=0, usetex=False,
10-
**kwargs):
10+
def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs):
1111

12+
x, y, z = xyz
1213
if zdir == "y":
1314
xy1, z1 = (x, z), y
1415
elif zdir == "y":
@@ -34,13 +35,14 @@ def text3d(ax, (x, y, z), s, zdir="z", size=None, angle=0, usetex=False,
3435

3536
text3d(ax, (4, -2, 0), "X-axis", zdir="z", size=.5, usetex=False,
3637
ec="none", fc="k")
37-
text3d(ax, (12, 4, 0), "Y-axis", zdir="z", size=.5, usetex=False, angle=.5*3.14159,
38-
ec="none", fc="k")
39-
text3d(ax, (12, 10, 4), "Z-axis", zdir="y", size=.5, usetex=False, angle=.5*3.14159,
40-
ec="none", fc="k")
38+
text3d(ax, (12, 4, 0), "Y-axis", zdir="z", size=.5, usetex=False,
39+
angle=.5*3.14159, ec="none", fc="k")
40+
text3d(ax, (12, 10, 4), "Z-axis", zdir="y", size=.5, usetex=False,
41+
angle=.5*3.14159, ec="none", fc="k")
4142

4243
text3d(ax, (1, 5, 0),
43-
r"$\displaystyle G_{\mu\nu} + \Lambda g_{\mu\nu} = \frac{8\pi G}{c^4} T_{\mu\nu} $",
44+
r"$\displaystyle G_{\mu\nu} + \Lambda g_{\mu\nu} = "
45+
r"\frac{8\pi G}{c^4} T_{\mu\nu} $",
4446
zdir="z", size=1, usetex=True,
4547
ec="none", fc="k")
4648

@@ -49,4 +51,3 @@ def text3d(ax, (x, y, z), s, zdir="z", size=None, angle=0, usetex=False,
4951
ax.set_zlim3d(0, 10)
5052

5153
plt.show()
52-

0 commit comments

Comments
 (0)