October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following are the steps to draw triangular surface plots:
# Make radii and angles arrays.radii = np.linspace(0., 1.0, 16)angles = np.linspace(0, 2*np.pi, 32)# Repeat all angles for each radius.angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)# Convert polar (radii, angles) coords to cartesian (x, y) coords.x = (radii*np.cos(angles)).flatten()y = (radii*np.sin(angles)).flatten()# Compute z to make the triangle surface.z = np.tan(x**2 + y**2)z1 = np.cos(x**2 + y**2)z2 = np.cos(x**3 + y**3)
fig = plt.figure(figsize=(12,6))
ax1 = fig.add_subplot(131, projection='3d')ax1.plot_trisurf(x, y, z, linewidth=0.5, ...
Read now
Unlock full access