title: AttributeError: 'AxesSubplot' object has no attribute 'set_canvas'
body: <p>Good morning,
  I am using tkinter with matplotlib but I am facing a problem which I will write down.</p>
  
  <p>I tried many solution but nothing worked, so if you had faced the problem before or if you just know it help me please with it.
  Here is my code:</p>
  
  <pre><code>import matplotlib
  matplotlib.use('TkAgg')
  from tkinter import *
  import tkinter.simpledialog
  import matplotlib.pyplot as plt
  import datetime
  from matplotlib.figure import Figure
  from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
  
  root = Tk()
  root.geometry('1000x600')
  middle = Frame(root)
  middle.pack()
  
  payments = {'.':0}
  m = datetime.datetime.now()
  
  
  def digram1():
      global m
  
      purpose = list(payments.keys())
      amounts = list(payments.values())  
      plt.plot((purpose),(amounts))
      plt.xlabel('Purpose')
      plt.ylabel('Amounts')
      plt.title('Outgoings for the '+ str(m.month)+'th month\n'+str(datetime.date.today()))
      plt.show
  
  
      fig = Figure(figsize=(5,5),dpi = 100)
      ex = fig.add_subplot(111)
      canvas = FigureCanvasTkAgg(ex,master=root)
      canvas.show()
      canvas.get_tk_widget().pack(side =tk.top,fill=tk.Both, expand = True)
  
  
  digram1m = Button(middle,text='1st digram',command=digram1, height = 5,width =15 , fg ='green')
  digram1m.grid(row = 5 , column = 6 ,sticky=E)
  
  root.mainloop()    
  </code></pre>
  
  <p>and here is the output:</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "C:\Users\A\Anaconda3\lib\tkinter\__init__.py", line 1699, in __call__
  return self.func(*args)
    File "&lt;ipython-input-1-6c5b0c8eaae5&gt;", line 33, in digram1
      canvas = FigureCanvasTkAgg(ex,master=root)
    File "C:\Users\A\Anaconda3\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 173, in __init__
      FigureCanvasAgg.__init__(self, figure)
    File "C:\Users\A\Anaconda3\lib\site-packages\matplotlib\backend_bases.py", line 1780, in __init__
      figure.set_canvas(self)
  AttributeError: 'AxesSubplot' object has no attribute 'set_canvas'
  </code></pre>
  
  <p>I am using Jupyter notebook 5.4.0.
  Thank you for your time..</p>