0

I'm trying to do a 3D animation in jupyter python with matplotlib and ipywidgets. (I also have spyder but I'm unfamiliar with it yet and as I'm using a chromebook, it's faster to start up jupyter. The chromenbook part is also important because if I don't use ipywidgets, I have to use HTML to see the animations).

My final objective is to animate some fireworks, but as I'm still learning to use mpl to do 3D animations, I'm trying something simpler. In this case, an animated spiral. Here's my code:

import ipywidgets as widgets
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt

def theta(t):
    fig = plt.figure(figsize=(10,10))
    ax  = plt.axes(projection = "3d")
    z   = np.linspace(0, t, 500)
    x   = np.sin(z)
    y   = np.cos(z)
    ax.plot3D(x, y, z, 'red')
    plt.show()
    
widgets.interact(theta, t = widgets.Play(min=0, max = 15, interval = 700), continuous_update = False);

Everything works just fine but I need to increase the FPS, as the animation is only around 1.5 FPS. Is this possible? How can I do this? Thanks

0 Answers0