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

3 Answers

I had this same error and my solution was changing ffn/core.py (it was the first file in the error list, your file is different I see, but same principle norm something must be deprecated?)

from

ax = ser.hist(bins=bins, figsize=figsize, normed=True, **kwargs)

to

ax = ser.hist(bins=bins, figsize=figsize, density=True, **kwargs)

point being: changing the normed to density i.e. here norm_hist to density

According to the documentation, displot indeed does not have this parameter.

your are confused with the deprecated distplot function (here) that has it.

2

You must use density insted of normed for errors as 'rectangle' object has no property 'normed'

4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest