High-Level Interface to Create Figures/Animations with Matplotlib

badge badge badge badge badge

This module provides a high-level interface to create figures/animations (currently only in matplotlib). It was designed to be used within PHOEBE but written in a way that it can be used as a standalone package.

autofig aims to provide the following:

  • a unified calling structure to matplotlib's plot, scatter, errorbar, LineCollection, and PolyCollection in both 2D and 3D projections. So if you decide you want to add errorbars or colorscaling to an existing plot call, you don't need to change the entire calling structure anymore.
  • basic "3D" support within 2D figures (by providing the z-coordinate, the z-orders will automatically be set)
  • a high-level wrapper to animate an existing plot over some independent-variable (i.e. time), with effects including highlight and uncover.
  • intelligent options for axes limits within animations.
  • intelligent defaults for subplot creation based on conflicts in units/labels.

In general, autofig attempts to provide smart defaults with a high-level interface while still providing full customization with access to the underlying matplotlib objects.

Getting Started


autofig requires the following dependencies:

You can see the Travis testing matrix for details on what exact versions have been tested and ensured to work. If you run into any issues with dependencies, please submit an issue.


autofig is available via pip:

pip install autofig

Alternatively, to install from source, use the standard python commands.

To install globally:

python build
sudo python install

Or to install locally:

python build
python install --user


Now from within python we can import the autofig package:

import autofig


Browse the gallery to find an example script for various types of figures.

API Documentation

See the API documentation for full details on each type of available distribution.

How it works

autofig builds up objects for the Figure, Axes, and individual plotting Calls (currently Plot or Mesh). These then handle high-level functionality such as axes limits and subplot placement.


Kyle Conroy

Contributions are welcome! Feel free to file an issue or fork and create a pull-request.