How do I plot a 3D Lorenz attractor with x, y and z labels?
I have been attempting to perform a 3D wireframe plot of the solution to the Lorenz equations, which is stored in the variables X, Y and Z. This is what I am presently using (unsuccessfully I might add):
# Plot the result
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import axes3d
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
plt.figure(1)
plt.xlabel('X(t)')
plt.ylabel('Y(t)')
plt.zlabel('Z(t)')
axes3d.plot_wireframe(X,Y,Z)
plt.show()
How do I get this plot to work? I'm guessing you'll probably be able to guess that X, Y and Z are ndarrays, produced from this SageMath script:
x,y,z=var('x,y,z')
# Next we define the parameters
sigma=10
rho=28
beta=8/3
# The Lorenz equations
lorenz=[sigma*(y-x),x*(rho-z)-y,x*y-beta*z]
# Time and initial conditions
N=250000
tmax=250
h=tmax/N
t=srange(0,tmax+h,h)
ics=[0,1,1]
sol=desolve_odeint(lorenz,ics,t,[x,y,z],rtol=1e-13,atol=1e-14)
X=sol[:,0]
Y=sol[:,1]
Z=sol[:,2]
Googling a bit, I found a nice blog post here
http://sagemath.blogspot.cl/2008/01/j...
Thanks, you wouldn't happen to know where I can find detailed documentation on line3d would ya? I've Googled it but I can't find anything better than this, which is pretty minimal (only one mention to line3d in the entire document).