Skip to content

fix: exclude list-like s parameter in plot.scatter #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bigframes/operations/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ def __init__(self, data, **kwargs) -> None:
f"Only support a single color string or a column name/posision. {constants.FEEDBACK_LINK}"
)

s = self.kwargs.get("s", None)
if self._is_sequence_arg(s):
raise NotImplementedError(
f"Only support a single color string or a column name/posision. {constants.FEEDBACK_LINK}"
)

def _compute_plot_data(self):
sample = self._compute_sample_data(self.data)

Expand Down
16 changes: 16 additions & 0 deletions tests/system/small/operations/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,22 @@ def test_scatter_args_c(c):
)


@pytest.mark.parametrize(
("arg_name"),
[
pytest.param("c", marks=pytest.mark.xfail(raises=NotImplementedError)),
pytest.param("s", marks=pytest.mark.xfail(raises=NotImplementedError)),
],
)
def test_scatter_sequence_arg(arg_name):
data = {
"a": [1, 2, 3],
"b": [1, 2, 3],
}
arg_value = [3, 3, 1]
bpd.DataFrame(data).plot.scatter(x="a", y="b", **{arg_name: arg_value})


def test_sampling_plot_args_n():
df = bpd.DataFrame(np.arange(bf_mpl.DEFAULT_SAMPLING_N * 10), columns=["one"])
ax = df.plot.line()
Expand Down
3 changes: 0 additions & 3 deletions third_party/bigframes_vendored/pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,6 @@ def scatter(

- A string with the name of the column to be used for marker's size.
- A single scalar so all points have the same size.
- A sequence of scalars, which will be used for each point's size
recursively. For instance, when passing [2,14] all points size
will be either 2 or 14, alternatively.

c (str, int or array-like, optional):
The color of each point. Possible values are:
Expand Down