pairplot fails with hue_order not containing all hue values in seaborn 0.11.1
See original GitHub issueIn seaborn < 0.11, one could plot only a subset of the values in the hue column, by passing a hue_order list containing only the desired values. Points with hue values not in the list were simply not plotted.
iris = sns.load_dataset("iris")`
# The hue column contains three different species; here we want to plot two
sns.pairplot(iris, hue="species", hue_order=["setosa", "versicolor"])
This no longer works in 0.11.1. Passing a hue_order list that does not contain some of the values in the hue column raises a long, ugly error traceback. The first exception arises in seaborn/_core.py:
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
seaborn version: 0.11.1 matplotlib version: 3.3.2 matplotlib backends: MacOSX, Agg or jupyter notebook inline.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6 (5 by maintainers)
Top Results From Across the Web
seaborn.pairplot — seaborn 0.12.1 documentation - PyData |
If a dict, keys should be values in the hue variable. varslist of variable names. Variables within data to use, otherwise use every...
Read more >Seaborn pairplot hue parameter not working as expected
By default, seaborn will show all numeric columns! So if your 'hue' column ('C' in your case) column as string(object) type, it will...
Read more >Seaborn Pairplot in Detail| Python Seaborn Tutorial
Seaborn Pairplot uses to get the relation between each and every variable present in Pandas DataFrame. It works like a seaborn scatter plot....
Read more >python - Adding another 'hue' to a pairplot
I have plotted a pairplot in Seaborn with a hue, similar to the one shown below. I would like to add another hue...
Read more >How to make a pairplot in Python and the Seaborn ... - YouTube
This Seaborn paiplot video covers how to make a pairplot with Seaborn Python as well as the Seaborn pairplot interpretation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Easiest workaround is probably
Closed with #2848