reproducible research: sys.argv[0] in plot footer #289

ddale opened this Issue Jun 20, 2011 · 7 comments


None yet

5 participants

ddale commented Jun 20, 2011

Original report at SourceForge, opened Mon May 2 17:45:15 2005

the WaveLab wavelet toolbox for MATLAB has a nice tool to put
date, user name and a footer (usually the name of the script/.m-file,
and the input data file) in each plot (using small font sizes).
this is part of their reproducible research approach.
see <URL: >

i find this very interesting and would like to see a function for this
in matplotlib. an example of how useful this is: if this approach were
used in the matplotlib examples and the documentation, it would be
very easy to find the example script. (are all scripts/plots in the manual
available in the example archive?)

or it should probably even be a setting in .matplotlibrc to always
put this "reproducible research footer" on all plots.

another question (completely different topic): is it possible to always position
new plot windows in the upper right corner of the screen? (a .matplotlibrc setting)

efiring commented Jun 21, 2011

This is an ancient request, but still not a bad idea.


Personally, I prefer Makefiles, python scripts with command-line arguments, and version-control. Plus, wouldn't we start running into issues with respect to differing versions of software?

efiring commented Jun 21, 2011

I view the request as simply for a little utility function or method, similar to suptitle(), that would put a string in small print along some edge of a figure. I didn't think it through beyond that. I wrote and used something like that back in my matlab days.

pelson commented Apr 16, 2012

Presumably something similar to the following is desired:

import datetime
import getpass
import matplotlib.pyplot as plt
import os

username = getpass.getuser()
now =
filename = os.path.basename(__file__)


plt.text(0.98, 0.5, 'File: {}; User: {}; Date: {}'.format(filename, username, now),
         rotation=90, fontsize=8,
         horizontalalignment='right', verticalalignment='center')
pelson commented Oct 18, 2012

To be completely explicit, I am against the use of sys.argv to automatically produce a traceable name in the plot, although I do like the idea other than that.

The problem with this issue is that there doesn't seem to be a strong advocate of it (who knows what they want). I'm tempted to close this issue as, whoever that person is, will probably not learn an awful lot from what has gone before in this ticket...

Does anybody want to take this on?


I would advocate closing this as well, there is not a general solution to this problem.

I would also be strongly against using sys.argv for generating this tag. For example, I generate a lot of plots via code sent to an ipython session from a org-mode file (that way I have a saved version of exactly what I ran) and for figures in paper have a stand alone script per figure.

On the other hand, maybe providing a hook that is called from savefig that can add what ever notions someone wants. ie

savefig_withhook(self, *args, **kwargs):
    hook_fun = reParams['fig.save_hook']
    if hook_fun is not None:
        added_artists = hook_fun(self) 
        added_artists = []
    self.savefig(*args, **kwargs)
    for a in added_artists:

where hook_fun takes an figure object as an argument and adds a list of the artists it adds. The user would define and set hook_fun in their script and get data in via the magic of closures.

efiring commented Jan 26, 2013

Let's just call this expired. We have enough to do fixing real bugs without getting bogged down in every request for some added complexity.

@efiring efiring closed this Jan 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment