DEV Community

Neha Sharma
Neha Sharma

Posted on

matplotlib tkinter AttributeError: 'AxesSubplot' object has no attribute 'canvas'

Matplotlib graph on tkinter canvas gives error - 'AxesSubplot' object has no attribute 'canvas'

# Create window
window = tkinter.Tk()
window.resizable()
window.state('zoomed')
# Create Title
window.title('Title')


# adding frame of buttons
BFrame = tkinter.Frame(window)
BFrame.pack(side=tkinter.TOP)    

# This defines the Python GUI backend to use for matplotlib
matplotlib.use('TkAgg')

# Initialize matplotlib
…

Top comments (0)