Skip to content

TST: Test change axis in boxplot #45899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pandas/tests/plotting/test_boxplot_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down