This repository demonstrates animated plots with Matplotlib in JupyterLab and Jupyter Notebook 7+ interfaces in sessions served via the MyBinder system.
(If your Jupyter interface is based on NbClassic or Jupyter Notebook 6.4 or earlier, see here.)
Not sure what flavor of Jupyter tech you are using for your notebooks, then see 'Quickly Navigating the tech of the Jupyter ecosystem post-2023'.
JupyterLab interface:
Jupyter Notebook 7+:
Click on launch binder badge above to spin up a sesion where you can run animated plots.
This demo is done in a full-featured, typical Jupyter session.
However, many of the approaches will work in JupyterLite, or can be made to work with some accomodations.
For a particular example, I have worked through offering JupyterLite-compatible implementations of three of the approaches here. The information provided there should make clear what options are available, and those examples can be used as a basis for code that will work in JupyterLite. (At present, all the code examples that will work in JupyterLite will also work back in a typical Jupyter instance with the ipykernel. However, the range of code that will work in typical Jupyter with an ipykernel at this time is much broader, with more options on how 'live' the animation display is.)
Click on launch binder badge above to spin up a sesion where you can run animated plots.