Solve the Error “AttributeError: ‘Rectangle’ object has no property ‘norm_hist’”

Python is a general-purpose and high-level programming language ideally used by programmers and developers to create web applications and website pages. It is also known for developing software, data analysis, task automation, and data visualizations. It is a widely used and well-accepted language that a simpler syntax that makes it a programmer-friendly programming language. When it comes to designing web applications, programming starts working with Python to complete the task. Python programming has become simpler with the libraries it has. Matplotlib is Python plotting and comprehensive library used for creating animated, static, and interactive visualizations. All these can be created in Python by programmers simply. Working with Matplotlib makes even harder things easier. When working with Matplotlib, you may encounter the error “AttributeError: ‘Rectangle’ object has no property ‘norm_hist’”.

In this post, we will provide you with useful information to get rid of this error warning. You can go through the post till the end to find the solution you have been looking for to crack the program code. Let’s figure out how the error shows up

How the error occurs

While trying to review seaborn and matplotlib packages using displot in order to create a histogram and the notes that try to highlight the difference between it showing density vs w/count, you use the following

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

This one is the example when trying to use the ‘iris’ dataset w/in seaborn. As soon as you use it, you land up in the error warning. This is what the script returns

[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 -", line 79, in <module>
    sns.displot(iris["sepal_length"], norm_hist=True, kde=False)

  File "C:\Users\cyrra\anaconda3\lib\site-packages\seaborn\", line 2227, in displot

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

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

  File "C:\Users\cyrra\anaconda3\lib\site-packages\matplotlib\axes\", line 2488, in bar

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

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

How To Fix the Error “AttributeError: ‘Rectangle’ object has no property ‘norm_hist’”

Solution 1 – Replace the code

To make the error go away, you need to make a minor change in your ffn/ file as it is the file that shows the error at the start. So, you just need to replace a code.

Replace this:

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

To this:

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

It helps you successfully resolve the error.

Solution 2 – Use the density keyword instead of the normed keyword

In order to resolve the error, you need to replace the normed keyword with the density keyword. This seems a simple solution but it is really effective that you can see when you try it.

Solution 3 – Correct use of parameter

It is noted that there is no parameter available in displot. The main cause of the error is when it is mixed with the deprecated function of displot. So, the correct approach to sort out the error, you need to examine the parameter and utilize the correct one.


And that’s how you can simply solve the error “AttributeError: ‘Rectangle’ object has no property ‘norm_hist’”. You can try out the one that fits the current condition of your project.

I hope it helps!

Leave a Reply

Your email address will not be published. Required fields are marked *