Briefly, is there a way to get a callback in the event
> that the canvas has been redrawn (e.g. from a zoom or
> pan)?
> matplotlib 0.86.2 python 2.4.1 wxPython 2.6.2.1 Mac OS
> X.4.7
> I draw a circle at a certain point. I let the user drag
> that point to a new location. However, if the plot is
> redrawn for any reason, I have to redraw my circle in a
> new position. I can't seem to find any way to get
> notified of a redraw.
Have you dried connecting to a draw_event?
def ondraw(event):
# do something
pass
fig.canvas.mpl_connect('draw_event', ondraw)
FYI, the widgets module matplotlib.widgets is a good place to look for
examples of mpl event handling, in addition to the class documentation
in the Event hierarchy in
http://matplotlib.sourceforge.net/matplotlib.backend_bases.html
JDH
Thank you! I realized later how to do this when I realized that I hadn't looked at the code for the canvases.
R.
PGP.sig (186 Bytes)
···
On Aug 29, 2006, at 12:08 AM, John Hunter wrote:
"Richard" == Richard Harvey Chapman <hchapman-matplotlib-users@...1232...> writes:
> Briefly, is there a way to get a callback in the event
> that the canvas has been redrawn (e.g. from a zoom or
> pan)?
> matplotlib 0.86.2 python 2.4.1 wxPython 2.6.2.1 Mac OS
> X.4.7
> I draw a circle at a certain point. I let the user drag
> that point to a new location. However, if the plot is
> redrawn for any reason, I have to redraw my circle in a
> new position. I can't seem to find any way to get
> notified of a redraw.
Have you dried connecting to a draw_event?
def ondraw(event):
# do something
pass
fig.canvas.mpl_connect('draw_event', ondraw)
FYI, the widgets module matplotlib.widgets is a good place to look for
examples of mpl event handling, in addition to the class documentation
in the Event hierarchy in
http://matplotlib.sourceforge.net/matplotlib.backend_bases.html
JDH
R.