On Mon, Jul 16, 2012 at 3:07 PM, John Hunter <jdh2358@gmail.com> wrote:


On Tue, Jul 10, 2012 at 11:58 AM, Tony Yu <tsyu80@gmail.com> wrote:
Announcement: mpltools 0.1
==========================

mpltools is a package of tools for matplotlib. For the most part, these tools are only loosely-connected in functionality, but there are two that may prove particularly useful:

Styles and plot2rst
-------------------


Tony, is there  a way to "switch" styles rather than chain them.  Eg, if I do:

    import mpltools.style as style
    style.use('ieee.transaction')
    ...make_a_plot_...
    style.use('ggplot')
.    ..make_a_plot_...

I seem to get the chained behavior of the second style updating the first.  I'd like to use this in a demo context where I can illustrate the styles separately, so it would be nice to go back to the defaults.

Interestingly, I tried to do:

    import matplotlib
    matplotlib.rc_file_defaults()
    plt.close('all')
    hist(rand(10000), 100)

but that simply stopped figures from raising all together (I don't think this is related to mpltools, but to something funny going on on my system).

So in summary, it would be nice to be able to do something like:

    style.use('default')

or: 

    style.reset()

which would take you back to a clean slate.


I've been using plt.rcdefaults() for that purpose. Does that work for you?

-Tony