I’m following the example: https://matplotlib.org/gallery/mplot3d/rotate_axes3d.html
I believe the loop should animate the plot so that the viewing angle changes by a degree at a time. Running on a Linux machine this works as expected, however running on OSX the plot isn’t updated. I can get it to work by inserting a plt.tight_layout()
in the loop. Here’s the complete code:
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# load some test data for demonstration and plot a wireframe
X, Y, Z = axes3d.get_test_data(0.1)
ax.plot_wireframe(X, Y, Z, rstride=5, cstride=5)
# rotate the axes and update
for angle in range(0, 360):
ax.view_init(30, angle)
plt.draw()
plt.tight_layout() # Line I added
plt.pause(.001)
I’m using ipython3. Let me know if you need any other info.