# draw - erase - replot
import matplotlib.pyplot as plt
import numpy as np
import pdb
plt.ion()
x = np.linspace(0, 2*3.14, 100)
y = np.sin(x)
pts = []
fig, ax = plt.subplots()
pt1, = ax.plot(x, y)
pt2, = ax.plot(x, y + 2)
pts = [pt1, pt2]
#pnt.figure.canvas.mpl_connect('button_press_event', onPress)
#pnt.figure.canvas.mpl_connect('motion_notify_event', onPress)
input("Tap Enter: ")
plt.cla()
input("Tap Enter: ")
x = pts[0].get_xdata()
y = pts[0].get_ydata()
ax.plot(x, y)
x = pts[1].get_xdata()
y = pts[1].get_ydata()
ax.plot(x, y)
input('Tap Enter: ')
plt.show()
Like this:
Like Loading...
Related