I want to be able to ascertain the provenance of the figures I create using matplotlib, i.e. to know which version of my code and data created these figures. (See this essay for
As of matplotlib version 2.1.0, the savefig command accepts the keyword argument metadata. You pass in a dictionary with string key/value pairs to be saved.
This only fully works with certain the 'agg' backend for PNG files.
For PDF and PS files you can use a pre-defined list of tags.