Skip to content
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

plot.scatter(hue_style="invalid") does not raise an exception #7908

Closed
4 tasks done
mgunyho opened this issue Jun 12, 2023 · 0 comments · Fixed by #7925
Closed
4 tasks done

plot.scatter(hue_style="invalid") does not raise an exception #7908

mgunyho opened this issue Jun 12, 2023 · 0 comments · Fixed by #7925

Comments

@mgunyho
Copy link
Contributor

mgunyho commented Jun 12, 2023

What happened?

If I do a scatterplot with hue_style=x, where x is not "continuous" or "discrete", the result is the same as passing hue_style="continuous".

Probably related to #7907.

What did you expect to happen?

An invalid value should raise an exception.

Minimal Complete Verifiable Example

import matplotlib.pyplot as plt
import numpy as np
import xarray as xr

x = xr.DataArray(
    np.random.default_rng().random((10, 3)),
    coords=[
        ("idx", np.linspace(0, 1, 10)),
        ("color", [1, 2, 3]),
    ]
)

x.plot.scatter(x="idx", hue="color", hue_style="invalid", ax=plt.figure().gca())
plt.show()

MVCE confirmation

  • Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • Complete example — the example is self-contained, including all data and the text of any traceback.
  • Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

No response

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS

commit: None
python: 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0]
python-bits: 64
OS: Linux
OS-release: 5.14.0-1059-oem
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: None
libnetcdf: None

xarray: 2023.1.0
pandas: 1.4.3
numpy: 1.23.0
scipy: None
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.5.3
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 44.0.0
pip: 20.0.2
conda: None
pytest: None
mypy: None
IPython: 8.12.2
sphinx: None

I also tried this on main at 3459e6f, the behavior is the same.

@mgunyho mgunyho added bug needs triage Issue that has not been reviewed by xarray team member labels Jun 12, 2023
@mgunyho mgunyho changed the title plot.scatter(hue_style="invalid") does not raise an exception plot.scatter(hue_style="invalid") does not raise an exception Jun 12, 2023
@dcherian dcherian added topic-plotting and removed needs triage Issue that has not been reviewed by xarray team member labels Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants