Closed mishachada closed 2 months ago
I cannot replicate your issue
Maybe you are using an old version of seaborn.
This could be a numpy issue. See https://github.com/mwaskom/seaborn/issues/3192
Closing as not reproducible, happy to reopen with an example that demonstrates an issue on the latest version.
Description
I encountered a
TypeError
when usingseaborn.kdeplot
with thefill=True
option and a categorical hue in my dataset. The error message indicates that there is a problem with data types being passed to thematplotlib
fill function.Steps to Reproduce
Here is a minimal reproducible example:
Expected Behavior
The KDE plot should render successfully with the filled areas for different categories.
Actual Behavior
The plot does not render, and the following error is thrown: TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Suggested Fix or Improvement
It seems that kdeplot with fill=True might need better handling for different data types or clearer documentation on the expected data types. Additionally, improving error messages to guide users to the correct data type could help prevent this issue.
A temporary workaround I found was using matplotlib directly for creating ridge plots, as shown below:
Additional Notes
It would be helpful to either enhance the kdeplot function to handle this more gracefully or provide a warning if the data type might cause an error.