Skip to content

Commit

Permalink
Update README and TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-ramadhan committed Jun 30, 2024
1 parent 44b2ceb commit bee657e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,16 @@
<img alt="PyPI version" src="https://badge.fury.io/py/matplotloom.svg">
</a>
<a href="https://aliramadhan.me/matplotloom/">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-stable%20release-blue?style=flat-square">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-stable-blue?style=flat-square">
</a>
<a href="https://github.com/ali-ramadhan/matplotloom/actions/workflows/testing.yml">
<img alt="Tests" src="https://github.com/ali-ramadhan/matplotloom/actions/workflows/testing.yml/badge.svg">
</a>
<a href="https://github.com/ali-ramadhan/matplotloom/actions/workflows/sphinx.yml">
<img alt="Docs" src="https://github.com/ali-ramadhan/matplotloom/actions/workflows/testing.yml/badge.svg">
<img alt="Docs" src="https://github.com/ali-ramadhan/matplotloom/actions/workflows/sphinx.yml/badge.svg">
</a>
</p>

## Why use matplotloom?

To visualize simulation output for computational fluid dynamics I've had to make long animations with complex figures for a long time. The animations consist of thousands of frames and the figures are too complex for `FuncAnimation` and `ArtistAnimation`. This package aims to simplify and massively speed up the process of making these kinds of animations.

* The main idea behind matplotloom is to describe how to generate each frame of your animation from scratch, instead of generating an animation by modifying one existing plot. This simplifies generating animations. See the examples below and how the code inside the `for` loops is plain and familiar matplotlib. It also ensures that every feature can be animated and that the generation process can be easily parallelized.
* matplotlib has two tools for making animations: `FuncAnimation` and `ArtistAnimation`. But to use them you have to write your plotting code differently to modify an existing frame. This makes it difficult to go from plotting still figures to making animations. And some features are non-trivial to animate.
* [celluloid](https://github.com/jwkvam/celluloid) is a nice package for making matplotlib animations easily, but as it relies on `ArtistAnimation` under the hood it does come with some [limitations](https://github.com/jwkvam/celluloid?tab=readme-ov-file#limitations) such as not being able to animate titles. It also hasn't been maintained since 2018.
* Plotting many frames (hundreds to thousands+) can be slow but with matplotloom you can use a parallel `Loom` to plot each frame in parallel, speeding up the animation process significantly especially if you can dedicate many cores to plotting.

## Some notes to users

* You can use `loom.show()` to display animations in Jupyter notebooks.
* Anxious about animation progress? Pass `verbose=True` or use [tqdm](https://github.com/tqdm/tqdm) to monitor progress.
* Animations taking too long to make or do you have tons of frames? You can parallelize frame creating by [looming in parallel](#looming-in-parallel).
* You have to call `loom.save_frame(fig)` for each frame (see the examples). While the `Loom` object can be made to do this automatically it would have to create and own the `Figure` instance and I wanted full control over the creation of the `Figure` for maximum flexibility.
* matplotloom is going to be slow. But it's flexible and compatible with all of matplotlib! The real speedup comes from parallelizing frame creation, especially if you have a ton of frames to make.

## Installation

matplotloom is published on PyPI so you can install matplotloom via `pip`
Expand All @@ -66,6 +49,23 @@ conda install matplotloom

matplotloom requires Python 3.9+ and is continuously tested on Linux, Windows, and Mac. Ensure you have `ffmpeg` installed so that animations can be generated.

## Why use matplotloom?

To visualize simulation output for computational fluid dynamics I've had to make long animations with complex figures for a long time. The animations consist of thousands of frames and the figures are too complex for `FuncAnimation` and `ArtistAnimation`. This package aims to simplify and massively speed up the process of making these kinds of animations.

* The main idea behind matplotloom is to describe how to generate each frame of your animation from scratch, instead of generating an animation by modifying one existing plot. This simplifies generating animations. See the examples below and how the code inside the `for` loops is plain and familiar matplotlib. It also ensures that every feature can be animated and that the generation process can be easily parallelized.
* matplotlib has two tools for making animations: `FuncAnimation` and `ArtistAnimation`. But to use them you have to write your plotting code differently to modify an existing frame. This makes it difficult to go from plotting still figures to making animations. And some features are non-trivial to animate.
* [celluloid](https://github.com/jwkvam/celluloid) is a nice package for making matplotlib animations easily, but as it relies on `ArtistAnimation` under the hood it does come with some [limitations](https://github.com/jwkvam/celluloid?tab=readme-ov-file#limitations) such as not being able to animate titles. It also hasn't been maintained since 2018.
* Plotting many frames (hundreds to thousands+) can be slow but with matplotloom you can use a parallel `Loom` to plot each frame in parallel, speeding up the animation process significantly especially if you can dedicate many cores to plotting.

## Some notes to users

* You can use `loom.show()` to display animations in Jupyter notebooks.
* Anxious about animation progress? Pass `verbose=True` or use [tqdm](https://github.com/tqdm/tqdm) to monitor progress.
* Animations taking too long to make or do you have tons of frames? You can parallelize frame creating by [looming in parallel](#looming-in-parallel).
* You have to call `loom.save_frame(fig)` for each frame (see the examples). While the `Loom` object can be made to do this automatically it would have to create and own the `Figure` instance and I wanted full control over the creation of the `Figure` for maximum flexibility.
* matplotloom is going to be slow. But it's flexible and compatible with all of matplotlib! The real speedup comes from parallelizing frame creation, especially if you have a ton of frames to make.

## Examples

### Sine wave
Expand Down
5 changes: 0 additions & 5 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
* https://github.com/matplotlib/matplotlib/blob/v3.8.3/lib/matplotlib/_animation_data.py
* Output writers besides ffmpeg?

## Documentation

* Add some badges to the README.
* Add documentation GitHub Action.

## Examples

* Lorenz63: https://docs.makie.org/stable/

0 comments on commit bee657e

Please sign in to comment.