Problem updating view angle of 3D plot using OSX

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.

What backend are you using? (plt.get_backend())

You could try switching to TkAgg.

Works for me on macOS 10.15.4, Python 3.8.2, IPython 7.14.0, matplotlib 3.2.1 (all from conda-forge).

I’m using MacOSX backend.

To be clear, the above quoted code works fine. It’s only when you remove the plt.tight_layout() that it fails.