Skip to content

Commit 1caac27

Browse files
authored
fix: exclude list-like s parameter in plot.scatter (#568)
1 parent ea95761 commit 1caac27

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

bigframes/operations/_matplotlib/core.py

+6
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ def __init__(self, data, **kwargs) -> None:
9898
f"Only support a single color string or a column name/posision. {constants.FEEDBACK_LINK}"
9999
)
100100

101+
s = self.kwargs.get("s", None)
102+
if self._is_sequence_arg(s):
103+
raise NotImplementedError(
104+
f"Only support a single color string or a column name/posision. {constants.FEEDBACK_LINK}"
105+
)
106+
101107
def _compute_plot_data(self):
102108
sample = self._compute_sample_data(self.data)
103109

tests/system/small/operations/test_plotting.py

+16
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,22 @@ def test_scatter_args_c(c):
240240
)
241241

242242

243+
@pytest.mark.parametrize(
244+
("arg_name"),
245+
[
246+
pytest.param("c", marks=pytest.mark.xfail(raises=NotImplementedError)),
247+
pytest.param("s", marks=pytest.mark.xfail(raises=NotImplementedError)),
248+
],
249+
)
250+
def test_scatter_sequence_arg(arg_name):
251+
data = {
252+
"a": [1, 2, 3],
253+
"b": [1, 2, 3],
254+
}
255+
arg_value = [3, 3, 1]
256+
bpd.DataFrame(data).plot.scatter(x="a", y="b", **{arg_name: arg_value})
257+
258+
243259
def test_sampling_plot_args_n():
244260
df = bpd.DataFrame(np.arange(bf_mpl.DEFAULT_SAMPLING_N * 10), columns=["one"])
245261
ax = df.plot.line()

third_party/bigframes_vendored/pandas/plotting/_core.py

-3
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,6 @@ def scatter(
257257
258258
- A string with the name of the column to be used for marker's size.
259259
- A single scalar so all points have the same size.
260-
- A sequence of scalars, which will be used for each point's size
261-
recursively. For instance, when passing [2,14] all points size
262-
will be either 2 or 14, alternatively.
263260
264261
c (str, int or array-like, optional):
265262
The color of each point. Possible values are:

0 commit comments

Comments
 (0)