matplotlib update graphic
Bonsoir,
J'ai une fonction plotting_trials qui me fait un graph via la librairie matplotib...
Je souhaite updater mon graphique en appuyant sur une touche.
Mon souci est que je souhaite boucler selon un compteur et que je n'y parviens pas.
Ci joint ma tentative.
Merci à vous
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| import sys
def press(event):
global t
t=0
print('press', event.key)
sys.stdout.flush()
if event.key=='n':
plotting_trials(t)
t+=1
if event.key=='b':
plotting_trials(t)
t-=1
return t
while t <344:
fig, ax = plt.subplots()
fig.canvas.mpl_connect('key_press_event', press)
plt.show() |