Skip to content

Commit

Permalink
Matplotlib backcompat in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom committed Dec 6, 2023
1 parent 785242b commit 872c7fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_relational.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ def test_relplot_weighted_estimator(self, long_df):

g = relplot(data=long_df, x="a", y="y", weights="x", kind="line")
ydata = g.ax.lines[0].get_ydata()
for i, label in enumerate(g.ax.get_xticklabels()):
pos_df = long_df[long_df["a"] == label.get_text()]
for i, level in enumerate(categorical_order(long_df["a"])):
pos_df = long_df[long_df["a"] == level]
expected = np.average(pos_df["y"], weights=pos_df["x"])
assert ydata[i] == pytest.approx(expected)

Expand Down Expand Up @@ -1072,8 +1072,8 @@ def test_weights(self, long_df):

ax = lineplot(long_df, x="a", y="y", weights="x")
vals = ax.lines[0].get_ydata()
for i, label in enumerate(ax.get_xticklabels()):
pos_df = long_df.loc[long_df["a"] == label.get_text()]
for i, level in enumerate(categorical_order(long_df["a"])):
pos_df = long_df[long_df["a"] == level]
expected = np.average(pos_df["y"], weights=pos_df["x"])
assert vals[i] == pytest.approx(expected)

Expand Down

0 comments on commit 872c7fc

Please sign in to comment.