-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Bug in legend of dataset.plot.scatter #4126
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
Labels
Comments
calling @dcherian for the rescue! |
The issue seems to be that the legend labels are overwritten incorrectly here. Removing the |
phausamann
added a commit
to phausamann/xarray
that referenced
this issue
Sep 7, 2020
4 tasks
dcherian
added a commit
that referenced
this issue
Sep 10, 2020
* Fix incorrect legend labels for Dataset.plot.scatter Closes #4126 * Update xarray/tests/test_plot.py Co-authored-by: Deepak Cherian <[email protected]>
thanks @dcherian & @phausamann ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
When using Dataset.scatter with hue being a variable of dtype string, the legend turns out to be wrong.
MCVE Code Sample
Output is (note the legend):

Playing around it seems that it always chooses the first 4 values as the legend labels (note that the order of colors of the points is correct):
And if there are only 3 labels in total it chooses the first 3:
Expected Output
Legend in first two plots should read 'ABCD' and last plot 'ABC'
Versions
Output of xr.show_versions()
INSTALLED VERSIONS
commit: None
libhdf5: 1.10.4
libnetcdf: None
xarray: 0.15.1
pandas: 0.25.1
numpy: 1.17.2
scipy: 1.3.1
netCDF4: None
pydap: None
h5netcdf: None
h5py: 2.9.0
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.2.1
dask: 2.5.2
distributed: 2.5.2
matplotlib: 3.1.1
cartopy: None
seaborn: 0.9.0
numbagg: None
setuptools: 41.4.0
pip: 19.2.3
conda: 4.8.1
pytest: 5.2.1
IPython: 7.8.0
sphinx: 2.2.0
The text was updated successfully, but these errors were encountered: