Skip to main content

Make animated gifs out of multiple data plots.

Project description

A Python package for easily making clean animated gifs of data plots, datagif is built on top of seaborn to manage the plot generation, and imageio to manage creating the animated gif.

Example GIF

Code for this example can be found in the examples directory.

How to use datagif

The method you need is named after the package, so use the following import statement

from datagif import datagif

Your data will need to be in the form of a pandas DataFrame, with at least three columns. Select one to be the time dimension, and then the simplest example looks like the following


Customizing your GIF

There are four important arguments for customizing your GIF and the plots that make it up:

  • plt_funcs (Functions that are normally called like plt.title())

  • seaborn_funcs (Functions that are normally called like sns.set_theme())

  • seaborn_args (Arguments to add to the plot functions)

  • imageio_args (Arguments for the imageio get_writer() method)

For the _funcs arguments, these should be in the form of a dict where the keys are strings of the names of the functions you want to call, and the values should be the arguments you want to pass to the functions. These values can themselves be

  • a single value, like a string

  • a list to be unpacked and passed to the function

  • a dictionary to be unpacked and passed to the function as keyword arguments

For the _args arguments, these should be in the form of a dict that will be passed to the plotting and imageio functions as keyword arguments.

Using multiple plots in one GIF

As in the example above, you can layer multiple plots in one GIF! To do this, simply make the plots argument a list of valid strings. Then also make the x, y, seaborn_args arguments into lists of valid values the same length as the plots list, and the nth entry of these other arguments will be used for the nth plot.

Helpful Tips

It is strongly recommended to use the tight_layout method in the plt_funcs argument. This will help prevent small differences between the plots produced, leading to a much cleaner GIF.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datagif-0.1.1.tar.gz (18.5 kB view hashes)

Uploaded Source

Built Distribution

datagif-0.1.1-py3-none-any.whl (17.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page