Skip to content

Commit ccf1c1c

Browse files
committed
Resolve matplotlib cleanup issue
1 parent 19e56c7 commit ccf1c1c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

pandas/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,8 +1951,8 @@ def ip():
19511951
return InteractiveShell(config=c)
19521952

19531953

1954-
@pytest.fixture
1955-
def mpl_cleanup():
1954+
@pytest.fixture(autouse=True)
1955+
def mpl_cleanup(doctest_namespace):
19561956
"""
19571957
Ensure Matplotlib is cleaned up around a test.
19581958

pandas/plotting/_core.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,20 +621,29 @@ def boxplot_frame(
621621
returned by `boxplot`. When ``return_type='axes'`` is selected,
622622
the matplotlib axes on which the boxplot is drawn are returned:
623623
624+
.. plot::
625+
:context: close-figs
626+
624627
>>> boxplot = df.boxplot(column=["Col1", "Col2"], return_type="axes")
625628
>>> type(boxplot)
626629
<class 'matplotlib.axes._axes.Axes'>
627630
628631
When grouping with ``by``, a Series mapping columns to ``return_type``
629632
is returned:
630633
634+
.. plot::
635+
:context: close-figs
636+
631637
>>> boxplot = df.boxplot(column=["Col1", "Col2"], by="X", return_type="axes")
632638
>>> type(boxplot)
633639
<class 'pandas.Series'>
634640
635641
If ``return_type`` is `None`, a NumPy array of axes with the same shape
636642
as ``layout`` is returned:
637643
644+
.. plot::
645+
:context: close-figs
646+
638647
>>> boxplot = df.boxplot(column=["Col1", "Col2"], by="X", return_type=None)
639648
>>> type(boxplot)
640649
<class 'numpy.ndarray'>

0 commit comments

Comments
 (0)