The simplest way of making GIFs and math videos with Python

The simplest way of making GIFs and math videos with Python

The easiest and fastest way to make GIFs and math videos with Python. How to create amazing animations in seconds using Celluloid.

“Celluloid, Easy Matplotlib Animations”

I really enjoy working with data visualization and I always wonder what’s the best way to provide more direct and intuitive visual interactions when I have to explain some result or complex model.

Lately, I’ve been growing to use GIFs and quick videos. Even if this makes the coding part harder and more complex, the result generally is much more efficient in communicating my findings and process.

But in Python, there’s always an easier and simpler way and to simplify the animating process, **[Celluloid](https://github.com/jwkvam/celluloid) was born.**

Using only 50 lines of code to deal with Matplotlib Artists and ArtistAnimations Celluloid creates an animation from the series of images you want to plot into the Camera abstraction.

Let’s start by installing the library with

$ pip install celluloid

Now let’s get to it!

Four usage examples

  1. The simplest one
  2. Evolution plot
  3. Working with images
  4. Using dynamic labels and titles

The simplest one

Let’s create a simple plot just to demonstrate the basic usage of how to run the code in a Jupyter notebook, but we could also use the method save(‘filename.gif_or_mp4’)

from celluloid import Camera ## getting the camera
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import HTML ## to show the animation in Jupyter
fig, ax = plt.subplots() ## creating my fig
camera = Camera(fig)## the camera gets the fig we'll plot
for i in range(10):
    ax.plot([i] * 5, c='black') ## 5 element array from 0 to 9
    camera.snap() ## the camera takes a snapshot of the plot
animation = camera.animate() ## animation ready
HTML(animation.to_html5_video()) ## displaying the animation

data-science jupyter-notebook tutorial data-visualization python

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Use Jupyter Notebook in 2020: A Beginner’s Tutorial

Use this tutorial to learn how to create your first Jupyter Notebook, important terminology, and how easily notebooks can be shared and published online. The Jupyter Notebook is an incredibly powerful tool for interactively developing and presenting data science projects. This article will walk you through how to use Jupyter Notebooks for data science projects and how to set it up on your local machine

Why Jupyter Notebooks are the Future of Data Science

Why Jupyter Notebooks are the Future of Data Science. How Jupyter Notebooks played an important role in the incredible rise in popularity of Data Science and why they are its future.

Data Visualization With Python | Data Visualization | Python For Data Science

🔥To access the slide deck used in this session for Free, click here: https://bit.ly/GetPDF_DataV_P 🔥 Great Learning brings you this live session on 'Data Vis...

Applied Data Science with Python Certification Training Course -IgmGuru

Master Applied Data Science with Python and get noticed by the top Hiring Companies with IgmGuru's Data Science with Python Certification Program. Enroll Now

Data Science Tools Illustrated Study Guides

These data science tools illustrated guides are broken up into four distinct categories: data retrieval, data manipulation, data visualization, and engineering tips. Both online and PDF versions of these guides are available.