Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- from matplotlib.widgets import Slider
- import tkinter as tk
- def b1():
- plt.clf()
- ax = fig.add_subplot(111)
- x = np.arange(0, 10, 0.1)
- y = np.sin(x)
- ax.plot(x, y)
- fig.canvas.draw_idle()
- def b2():
- plt.clf()
- ax1 = fig.add_subplot(211)
- ax2 = fig.add_subplot(212)
- x = np.arange(0, 20, 0.1)
- y = np.sin(x**2)
- y2 = np.sin(np.sqrt(x))*2
- ax1.plot(x, y)
- ax2.plot(x, y2)
- fig.canvas.draw_idle()
- rt = tk.Tk()
- btn1 = tk.Button(rt, text='1', command=b1)
- btn2 = tk.Button(rt, text='2', command=b2)
- btn1.grid(column=0, row=0)
- btn2.grid(column=1, row=0)
- fig = plt.figure(figsize=(8, 4))
- plt.pause(0.01)
- rt.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement