On Wed, Apr 15, 2009 at 8:03 AM, Vito De Tullio <zak.mc.kra...@libero.it>wrote:
> Gregor Thalhammer wrote:
>
> > I didn't understand what you mean by 'plot nodes'
>
> the markers, sorry
>
> > , but there exist
> > figure_enter_event, figure_leave_event, axes_enter_event and
> > axes_leave_event, see
> >
>
> http://matplotlib.sourceforge.net/examples/event_handling/figure_axes_enter_leave.html
>
> first of all: why these *_enter_event and *_leave_event aren't in
>
> http://matplotlib.sourceforge.net/api/backend_bases_api.html#matplotlib.backend_bases.FigureCanvasBase.mpl_connect
This is just a doc oversight -- I'll fix it.
I think your solution is the right way to do it with the exiting mpl
infrastructure, though one could use the "blit" api to make it a little more
efficient to redraw just the needed artists rather than the whole figure
each time (doing this would further complicate the code). Since you call
your approach "ugly, and conceptually wrong", perhaps you can sketch what
you think the right interface should be for something like this, and we will
see if there is anything we can do within the existing mpl infrastructure to
make it easier.
FYI, check out the canvas.onHilite implementation, which shows how to use a
hover to highlight individual artists (title, axes, xlabel, ylabel,
ticklabel etc). This problem is a little
easier, since what you are doing is triggering an action on artist B when
artist A is hovered over.
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(np.random.rand(10))
ax.set_title('hover over me')
ax.set_xlabel('or me')
ax.set_ylabel('or me')
ax.grid()
fig.canvas.mpl_connect('motion_notify_event', fig.canvas.onHilite)
plt.show()
JDH
JDH
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users