AttributeError: ‘Rectangle’ object has no property ‘norm_hist’ – python

I am reviewing the matpoltlib and seaborn packages. I know this question is a little below the level of stack but no one can give me a solid answer about this error. I am using displot to make histograms and the notes are trying to show the difference between it displaying w/ count vs. density. Using the "iris" dataset w/in seaborn the first example is:

[IN]: sns.displot(iris["sepal_length"], kde=False) 
[OUT]: histogram, no curve, count on the y-axis

The next example uses "norm_hist" and is supposed to change the counts to densities and I am getting an error I don't understand?

[IN]: sns.displot(iris["sepal_length"], norm_hist=True, kde=False)
[OUT]: Traceback (most recent call last):

  File "C:\Users\cyrra\OneDrive\Documents\HDS 802 - Programming in Healthcare (Python & R)\Module 7 Python\M7P - MINE.py", line 79, in <module>
    sns.displot(iris["sepal_length"], norm_hist=True, kde=False)

  File "C:\Users\cyrra\anaconda3\lib\site-packages\seaborn\distributions.py", line 2227, in displot
    p.plot_univariate_histogram(**hist_kws)

  File "C:\Users\cyrra\anaconda3\lib\site-packages\seaborn\distributions.py", line 555, in plot_univariate_histogram
    artists = plot_func(

  File "C:\Users\cyrra\anaconda3\lib\site-packages\matplotlib\__init__.py", line 1438, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)

  File "C:\Users\cyrra\anaconda3\lib\site-packages\matplotlib\axes\_axes.py", line 2488, in bar
    r.update(kwargs)

  File "C:\Users\cyrra\anaconda3\lib\site-packages\matplotlib\artist.py", line 996, in update
    raise AttributeError(f"{type(self).__name__!r} object "

AttributeError: 'Rectangle' object has no property 'norm_hist'

Can someone explain this to me? I am looking through the documentation for seaborn and I can't seem to find these options. Were they deprecated? Unfortunately the material provided for my python class in my MS is from 2017 and they won't update it.

Thank you



Read more here: https://stackoverflow.com/questions/65781461/attributeerror-rectangle-object-has-no-property-norm-hist-python

Content Attribution

This content was originally published by Rachel Cyr at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: