11import matplotlib .pyplot as plt
22from matplotlib .patches import Circle , PathPatch
3+ # register Axes3D class with matplotlib by importing Axes3D
34from mpl_toolkits .mplot3d import Axes3D
45import mpl_toolkits .mplot3d .art3d as art3d
56from matplotlib .text import TextPath
67from 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
3536text3d (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
4243text3d (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,
4951ax .set_zlim3d (0 , 10 )
5052
5153plt .show ()
52-
0 commit comments