Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Save matplotlib figures with embedded metadata for reproducibility and profit

Project Description

Remember that time where you tried to remake a figure for your paper and couldn’t seem to get the same results? We’ve all been there. Well not anymore!

This module monkey patches the savefig command from matplotlib and inserts your current git commit hash into the metadata of the saved file. Currently it supports PNG and PDF figures.


First, install the module from PyPI:

pip install savefig

or from source:

git clone
cd savefig
python install

Then in all your code just add the following lines before importing matplotlib:

from savefig import monkey_patch

To read the metadata from an existing image file, run:

python -m savefig /path/to/figure.png

which will give you something like:

git-hash: 192a639c4a9eb7523e9becd23f359fd7d96e833f
git-date: 2014-03-29 21:30:27 -0400
git-author: Dan F-M

You can also get the diff between the saved commit hash and the version used to make the figure by running:

python -m savefig /path/to/figure.png --diff


Copyright 2014 Dan Foreman-Mackey

Available under the MIT License.

Release History

This version
History Node


History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(4.5 kB) Copy SHA256 Hash SHA256
Source None May 25, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting