Instantly share code, notes, and snippets.

Embed
What would you like to do?
import numpy
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
with open("lorenz.dat") as fd:
N, = numpy.fromfile(fd, numpy.dtype("i8"), 1)
dtype = numpy.dtype("{N}f8,({N},3)f8".format(N=N))
(time,state), = numpy.fromfile(fd, dtype, 1)
x,y,z = [ state[:,i] for i in range(3) ]
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.text2D(0.05, 0.95, "Lorenz attractor", transform=ax.transAxes)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.plot(x,y,z)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment