Pyplot connect to timer event?

Posted by Baron Yugovich on Stack Overflow See other posts from Stack Overflow or by Baron Yugovich
Published on 2014-08-18T18:26:00Z Indexed on 2014/08/18 22:20 UTC
Read the original article Hit count: 313

Filed under:
|
|

The same way I now have plt.connect('button_press_event', self.on_click) I would like to have something like plt.connect('each_five_seconds_event', self.on_timer)

How can I achieve this in a way that's most similar to what I've shown above?

EDIT: I tried

fig = plt.subplot2grid((num_cols, num_rows), (col, row), rowspan=rowspan,
                           colspan=colspan)
timer = fig.canvas.new_timer(interval=100, callbacks=[(self.on_click)])
timer.start()

And got

AttributeError: 'AxesSubplot' object has no attribute 'canvas'

© Stack Overflow or respective owner

Related posts about python

Related posts about matplotlib