Wouldn't a better default be to just close all figures when they're displayed? It can't be common that someone wants to show the same plot repeatedly (and if they do that could have an option)...?


On 14 Jul 2014 22:16, "Matthew Brett" <matthew.brett@gmail.com> wrote:

I am happily using `plot_directive`, but I've run into an
inconvenience when using the 'context' option.  Consider this rst

A title

.. plot::

    import matplotlib.pyplot as plt

Then some text.

.. plot::

    plt.plot(range(5), 'r')

In the second panel you see plots for both the first figure and the
second figure, because the underlying code is making this call:

        fig_managers = _pylab_helpers.Gcf.get_all_fig_managers()

to find all current figures, finding the first and the second figure,
and rendering both.  I think this is unlikely to be what the user
expects (it confused me), but I wasn't sure what the best way to work
round it was.  I considered adding another option like `:myfigs: true`
to the directive which would only pick up figures I create using the
current code block - is there a better way?



Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
Matplotlib-devel mailing list