March 2014
Beginner to intermediate
222 pages
4h 7m
English
As the previous recipe has demonstrated, what we have learned in the previous chapters stands true when creating three-dimensional figures. Let's confirm this by plotting 3D parametric curves. In this recipe, we keep the same dataset as in the previous recipe; that is, the Lorenz attractor.
In 2D, we draw curves by calling pyplot.plot(). As the previous recipe hinted, all we have to do here is set up an Axes3D instance and call its plot() method, as shown in the following code:
import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt a, b, c = 10., 28., 8. / 3. def lorenz_map(X, dt = 1e-2): X_dt = np.array([a * (X[1] - X[0]), X[0] * (b - X[2]) - X[1], X[0] * X[1] - c * X[2]]) ...
Read now
Unlock full access