Skip to content

Commit 872c7fc

Browse files
committed
Matplotlib backcompat in tests
1 parent 785242b commit 872c7fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_relational.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ def test_relplot_weighted_estimator(self, long_df):
582582

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

@@ -1072,8 +1072,8 @@ def test_weights(self, long_df):
10721072

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

0 commit comments

Comments
 (0)