Ray Hu
Ray Hu

Reputation: 31

Python seaborn histplot returns StopIteration

I installed seaborn, but when I do the example from the Seaborn website, I get StopIteration message, how do I fix it?

import seaborn as sns penguins = sns.load_dataset("penguins") sns.histplot(data=penguins, x="flipper_length_mm")

StopIteration Traceback (most recent call last) Cell In [33], line 1 ----> 1 sns.histplot(data=penguins, x="flipper_length_mm")

image

Upvotes: 2

Views: 1888

Answers (2)

Roger Compte
Roger Compte

Reputation: 41

The problem seem to be in the default color definition function. If you specify a color you can skip the error:

sns.histplot(data=penguins, x="flipper_length_mm", color='blue')

That solved the problem for me, hope it does for you as well. Cheers

Upvotes: 4

Alex
Alex

Reputation: 534

The problem is with matplotlib==3.6.1

You have 2 variants:

  1. Upgrade matplotlib up to 3.6.2 version via
pip install matplotlib --upgrade
  1. Downgrade matplotlib to 3.6.0 version via
pip install matplotlib==3.6.0 --force-reinstall

Both variants worked for me.
Here is the same issue on GitHub: https://github.com/mwaskom/seaborn/issues/3072

Upvotes: 3

Related Questions