Skip to content

Commit fb0d6e4

Browse files
Michael Vincent ManninoMichael Vincent Mannino
authored andcommitted
add test
1 parent 1ca57ed commit fb0d6e4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/plotting/frame/test_frame_color.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,21 @@ def test_scatter_with_c_column_name_with_colors(self, cmap):
207207
ax = df.plot.scatter(x=0, y=1, c="species", cmap=cmap)
208208
assert ax.collections[0].colorbar is None
209209

210+
def test_scatter_with_c_column_name_without_colors(self):
211+
df = DataFrame(
212+
{
213+
"dataX": range(100),
214+
"dataY": range(100),
215+
"state": ["NY", "MD", "MA", "CA"] * 25,
216+
}
217+
)
218+
df.plot.scatter("dataX", "dataY", c="state")
219+
220+
with tm.assert_produces_warning(None):
221+
ax = df.plot.scatter(x=0, y=1, c="state")
222+
223+
assert len(np.unique(ax.collections[0].get_facecolor())) == 4 # 4 states
224+
210225
def test_scatter_colors(self):
211226
df = DataFrame({"a": [1, 2, 3], "b": [1, 2, 3], "c": [1, 2, 3]})
212227
with pytest.raises(TypeError, match="Specify exactly one of `c` and `color`"):

0 commit comments

Comments
 (0)