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

Fix issue when an empty palette is provided for an empty dataset #3136

Merged
merged 2 commits into from
Dec 30, 2022

Conversation

thuiop
Copy link
Contributor

@thuiop thuiop commented Nov 11, 2022

Fixes issue #3118, by checking whether self._hue_palette.levels is None before calling len on it.

@codecov
Copy link

codecov bot commented Nov 11, 2022

Codecov Report

Merging #3136 (8586bb7) into master (d4d27ad) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 8586bb7 differs from pull request most recent head 51870ad. Consider uploading reports for the commit 51870ad to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3136   +/-   ##
=======================================
  Coverage   98.41%   98.41%           
=======================================
  Files          76       76           
  Lines       24076    24076           
=======================================
  Hits        23695    23695           
  Misses        381      381           
Impacted Files Coverage Δ
seaborn/categorical.py 98.54% <100.00%> (ø)

@mwaskom
Copy link
Owner

mwaskom commented Nov 11, 2022

As mentioned in the issue, I think that most functions short-circuit when there's no x/y data to avoid the need for this downstream special-casing.

This seems fine, but for it to be accepted, there would need to be a test replicating the original problem.

@thuiop
Copy link
Contributor Author

thuiop commented Nov 11, 2022

Actually it seems that only categorical plots would be concerned by the issue, as in the other cases len is never called on self._hue_map.levels. Anyway, I added a small test and checked that it failed before this PR and is now passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants