From: Matthew B. <mat...@gm...> - 2014-07-14 21:15:40
|
Hi, I am happily using `plot_directive`, but I've run into an inconvenience when using the 'context' option. Consider this rst file: ``` ####### A title ####### .. plot:: :context: import matplotlib.pyplot as plt plt.plot(range(10)) Then some text. .. plot:: :context: plt.figure() 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? Cheers, Matthew |