Viewing 3D Axes

Matplotview has built-in support for viewing 3D axes and plots.

plot 05 3d views
 7 import matplotlib.pyplot as plt
 8 import numpy as np
 9 from matplotview import view
10
11 X = Y = np.arange(-5, 5, 0.25)
12 X, Y = np.meshgrid(X, Y)
13 Z = np.sin(np.sqrt(X ** 2 + Y ** 2))
14
15 # Make some 3D plots...
16 fig, (ax1, ax2) = plt.subplots(1, 2, subplot_kw=dict(projection="3d"))
17
18 # Plot our surface
19 ax1.plot_surface(X, Y, Z, cmap="plasma")
20
21 # Axes 2 is now viewing axes 1.
22 view(ax2, ax1)
23
24 # Update the limits, and set the elevation higher, so we get a better view of the inside of the surface.
25 ax2.view_init(elev=80)
26 ax2.set_xlim(-10, 10)
27 ax2.set_ylim(-10, 10)
28 ax2.set_zlim(-2, 2)
29
30 fig.show()

Total running time of the script: (0 minutes 0.703 seconds)

Gallery generated by Sphinx-Gallery