Skip to content

Commit 84d2d79

Browse files
committed
add test
1 parent 97490e7 commit 84d2d79

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/plotting/test_boxplot_method.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pytest
1010

1111
from pandas import (
12+
Categorical,
1213
DataFrame,
1314
MultiIndex,
1415
Series,
@@ -408,6 +409,14 @@ def test_boxplot_group_no_xlabel_ylabel(self, vert, request):
408409
)
409410
assert target_label == pprint_thing(["group"])
410411

412+
@pytest.mark.filterwarnings("ignore:set_ticklabels:UserWarning")
413+
def test_boxplot_group_xlabel_ylabel(self, vert):
414+
df = DataFrame({'value': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
415+
'label': ['c', 'c', 'c', 'c', 'b', 'b', 'b', 'b', 'a', 'a']})
416+
df.label = Categorical(df.label, categories=['c', 'b', 'a'], ordered=True)
417+
ax = df.boxplot(by="label")
418+
xticklabels = ax.get_xticklabels()
419+
assert [x.get_text() for x in xticklabels] == ['c', 'b', 'a']
411420

412421
class TestDataFrameGroupByPlots:
413422
def test_boxplot_legacy1(self, hist_df):

0 commit comments

Comments
 (0)