Skip to content

Commit 4406906

Browse files
committed
TST: remove dependence on private attributes (pandas-dev#45809)
1 parent 9f5e363 commit 4406906

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

pandas/tests/plotting/frame/test_frame.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -791,13 +791,21 @@ def test_plot_scatter_with_norm(self):
791791
# added while fixing GH 45809
792792
import matplotlib as mpl
793793

794-
ax = self.hexbin_df.plot.scatter(x="A", y="B", c="C", norm=mpl.colors.LogNorm())
795-
assert ax.collections[0].norm._scale
794+
df = DataFrame(np.random.random((10, 3)) * 100, columns=["a", "b", "c"])
795+
norm = mpl.colors.LogNorm()
796+
ax = df.plot.scatter(x="a", y="b", c="c", norm=norm)
797+
assert ax.collections[0].norm is norm
796798

797799
def test_plot_scatter_without_norm(self):
798800
# added while fixing GH 45809
799-
ax = self.hexbin_df.plot.scatter(x="A", y="B", c="C")
800-
assert ax.collections[0].norm._scale is None
801+
import matplotlib as mpl
802+
803+
df = DataFrame(np.random.random((10, 3)) * 100, columns=["a", "b", "c"])
804+
ax = df.plot.scatter(x="a", y="b", c="c")
805+
color_min_max = (df.c.min(), df.c.max())
806+
default_norm = mpl.colors.Normalize(*color_min_max)
807+
for c in range(100):
808+
assert ax.collections[0].norm(c) == default_norm(c)
801809

802810
def test_plot_bar(self):
803811
df = DataFrame(

0 commit comments

Comments
 (0)