diff --git a/pandas/tests/plotting/test_boxplot_method.py b/pandas/tests/plotting/test_boxplot_method.py index d2a7d0fdb0cc2..0094c4a502bad 100644 --- a/pandas/tests/plotting/test_boxplot_method.py +++ b/pandas/tests/plotting/test_boxplot_method.py @@ -29,6 +29,27 @@ @td.skip_if_no_mpl class TestDataFramePlots(TestPlotBase): + def test_stacked_boxplot_set_axis(self): + # GH2980 + import matplotlib.pyplot as plt + + n = 80 + df = DataFrame( + { + "Clinical": np.random.choice([0, 1, 2, 3], n), + "Confirmed": np.random.choice([0, 1, 2, 3], n), + "Discarded": np.random.choice([0, 1, 2, 3], n), + }, + index=np.arange(0, n), + ) + ax = df.plot(kind="bar", stacked=True) + assert [int(x.get_text()) for x in ax.get_xticklabels()] == df.index.to_list() + ax.set_xticks(np.arange(0, 80, 10)) + plt.draw() # Update changes + assert [int(x.get_text()) for x in ax.get_xticklabels()] == list( + np.arange(0, 80, 10) + ) + def test_boxplot_legacy1(self): df = DataFrame( np.random.randn(6, 4),