Commit fad3b682 authored by sdiazpier's avatar sdiazpier

added clear figure between clicks

parent ab325127
Pipeline #2430 canceled with stages
......@@ -71,19 +71,27 @@ if __name__ == '__main__':
fig, ax = plt.subplots()
Q = ax.quiver(Y1, Y2, u, v, color='r')
def plot_trajectory(x0, model):
Q = ax.quiver(Y1, Y2, u, v, color='r')
tspan = np.linspace(0, 200, TRAJ_STEPS)
ys = odeint(model.dfun, x0, tspan)
ax.plot(ys[:,0], ys[:,1], 'b-') # path
ax.plot([ys[0,0]], [ys[0,1]], 'o') # start
ax.plot([ys[-1,0]], [ys[-1,1]], 's') # end
def onclick(event):
plot_trajectory([event.xdata,event.ydata], model_ode)
plot_trajectory([0.0,0.0], model_ode)
cid = fig.canvas.mpl_connect('button_press_event', onclick)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment