close

[Solved] AttributeError: ‘Figure’ object has no attribute ‘plot’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error AttributeError: ‘Figure’ object has no attribute ‘plot’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: ‘Figure’ object has no attribute ‘plot’ Error Occurs?

Today I get the following error AttributeError: ‘Figure’ object has no attribute ‘plot’ in python.

How To Solve AttributeError: ‘Figure’ object has no attribute ‘plot’ Error ?

  1. How To Solve AttributeError: 'Figure' object has no attribute 'plot' Error ?

    To Solve AttributeError: 'Figure' object has no attribute 'plot' Error You assign ax2 to a figure object which doesn't have a plot method defined. You want to create your axes using plt.axes instead

  2. AttributeError: 'Figure' object has no attribute 'plot'

    To Solve AttributeError: 'Figure' object has no attribute 'plot' Error You assign ax2 to a figure object which doesn't have a plot method defined. You want to create your axes using plt.axes instead

Solution 1

You assign ax2 to a figure object which doesn’t have a plot method defined. You want to create your axes using plt.axes instead

ax2 = plt.axes()
# Instead of ax2 = fig

Solution 2

instead of calling the figure with:

ax2 = fig #which just references the figure

try using gca() to extract the axes:

ax2 = fig.gca() #which is used to extract the axes

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read