Skip to content

TST: Verify plot order of a Series (GH38865) #39491

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 2 commits into from
Feb 2, 2021
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
19 changes: 19 additions & 0 deletions pandas/tests/plotting/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,25 @@ def test_plot_no_numeric_data(self):
with pytest.raises(TypeError, match="no numeric data to plot"):
df.plot()

@pytest.mark.parametrize(
"data, index",
[
([1, 2, 3, 4], [3, 2, 1, 0]),
([10, 50, 20, 30], [1910, 1920, 1980, 1950]),
],
)
def test_plot_order(self, data, index):
# GH38865 Verify plot order of a Series
ser = Series(data=data, index=index)
ax = ser.plot(kind="bar")

expected = ser.tolist()
result = [
patch.get_bbox().ymax
for patch in sorted(ax.patches, key=lambda patch: patch.get_bbox().xmax)
]
assert expected == result

def test_style_single_ok(self):
s = Series([1, 2])
ax = s.plot(style="s", color="C3")
Expand Down