I like that plots are displayed within the output of an ipython kernel. However, it would be nice to produce the figure across multiple cells, and call plt.show()
(or similar) at the end to display it.
As it stands, when using the inline backend, using PDB to set a breakpoint on plt.close
, I get the following stack trace:
[...]
-> return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
[...]\ipython\core\interactiveshell.py(2664)run_cell()
-> self.events.trigger('post_execute')
[...]\ipython\core\events.py(88)trigger()
-> func(*args, **kwargs)
[...]\pylab\backend_inline.py(113)flush_figures()
-> return show(True)
[...]\pylab\backend_inline.py(42)show()
-> matplotlib.pyplot.close('all')
I believe I would like to prevent flush_figures
from being called. Is there any way to remove this event from ipython's "post_execute"
event? While I'm aware that one option is to switch to another backend (I've seen some people suggest %matplotlib agg
), I'm hoping to keep the current behavior of displaying the plots, but only when I call plt.show()
. Other methods of achieving this, such as an alternate backend that doesn't call the flush_figures
event are also welcome.