In [3]:
import matplotlib.pyplot as plt
import Tkinter as tk

In [16]:
def plot_something():
    fig=plt.figure(1)
    plt.plot([0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,10,12,14,16,18,])
    plt.show()
    #plt.close(fig)

In [ ]:
root=tk.Tk()
root.withdraw()
b = tk.Button(root, text="Plot something", command=plot_something)
b.pack()

root.mainloop()

In [17]:
plot_something()

In [18]:
plt.plot([0,1,2,3,4])


Out[18]:
[<matplotlib.lines.Line2D at 0x7f998c801090>]

In [ ]: