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

Skip to content

Commit 6f17d15

Browse files
committed
Fix pathpatch3d_demo.py on Python 3
1 parent a720fd7 commit 6f17d15

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

examples/mplot3d/pathpatch3d_demo.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import matplotlib.pyplot as plt
22
from matplotlib.patches import Circle, PathPatch
3-
from mpl_toolkits.mplot3d import Axes3D
43
import mpl_toolkits.mplot3d.art3d as art3d
54
from matplotlib.text import TextPath
65
from matplotlib.transforms import Affine2D
76

87

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

10+
x, y, z = xyz
1211
if zdir == "y":
1312
xy1, z1 = (x, z), y
1413
elif zdir == "y":
@@ -34,13 +33,14 @@ def text3d(ax, (x, y, z), s, zdir="z", size=None, angle=0, usetex=False,
3433

3534
text3d(ax, (4, -2, 0), "X-axis", zdir="z", size=.5, usetex=False,
3635
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")
36+
text3d(ax, (12, 4, 0), "Y-axis", zdir="z", size=.5, usetex=False,
37+
angle=.5*3.14159, ec="none", fc="k")
38+
text3d(ax, (12, 10, 4), "Z-axis", zdir="y", size=.5, usetex=False,
39+
angle=.5*3.14159, ec="none", fc="k")
4140

4241
text3d(ax, (1, 5, 0),
43-
r"$\displaystyle G_{\mu\nu} + \Lambda g_{\mu\nu} = \frac{8\pi G}{c^4} T_{\mu\nu} $",
42+
r"$\displaystyle G_{\mu\nu} + \Lambda g_{\mu\nu} = "
43+
r"\frac{8\pi G}{c^4} T_{\mu\nu} $",
4444
zdir="z", size=1, usetex=True,
4545
ec="none", fc="k")
4646

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

5151
plt.show()
52-

0 commit comments

Comments
 (0)