Skip to content

Commit 8cede3a

Browse files
committed
RF: always close figures before plot directive
If we don't close figures, the plot directive can easily pick up figures from previous plot directives.
1 parent 6469b0e commit 8cede3a

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

doc/source/coordinate_systems.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ the array.
6060
We collected an anatomical image in the same session. We can load that image
6161
and look at slices in the three axes:
6262

63-
.. plot::
64-
:nofigs:
65-
:include-source: false
66-
67-
# This guy just closes the previous figure so we don't get it twice
68-
plt.close('all')
69-
7063
.. plot::
7164
:context:
7265

doc/sphinxext/plot_directive.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,9 @@ def render_figures(code, code_path, output_dir, output_base, context,
601601
for i, code_piece in enumerate(code_pieces):
602602

603603
if not context or config.plot_apply_rcparams:
604-
clear_state(config.plot_rcparams, close=not context)
604+
clear_state(config.plot_rcparams)
605+
else:
606+
plt.close('all')
605607

606608
run_code(code_piece, code_path, ns, function_name)
607609

0 commit comments

Comments
 (0)