Q:

Setting default histtype in matplotlib?

Is there a way to configure the default argument for histtype of matplotlib's hist() function? The default behavior is to make bar-chart type histograms, which I basically never want to look at, since it is horrible for comparing multiple distributions that have significant overlap.
In case it's somehow relevant, the default behavior I would like to attain is to have histtype='step'.

A:

Thank you for prompting me to look at this, as I much prefer 'step' style histograms too! I solved this problem by going into the matplotlib source code. I use anaconda, so it was located in anaconda/lib/site-packages/python2.7/matplotlib.
To change the histogram style I edited two of the files. Assuming that the current directory is matplotlib/, then open up axes/_axes.py and locate the hist() function there (it's on line 5690 on my machine, matplotlib version 1.5.1). You should see the histtype argument there. Change this to 'step'.
Now open up pyplot.py and again locate the hist() function and make the same change to the histtype argument (line 2943 in version 1.5.1 and on my machine). There is a comment about not editing this function, but I only found this to be an issue when I didn't also edit axes/_axes.py as well.
This worked for me! Another alternative would be just to write a wrapper around hist() yourself that changes the default argument. 

