On 07/08/07, fred <[EMAIL PROTECTED]> wrote:
> Angus McMorland a écrit :
>
> > Since all sorts of data can be displayed in am mpl window (e.g. a
> > plot, a contour...) you have to tell it how to access the correct
> > scalar value to display. You could do this with the
> > motion_notify_event. Register it during init, something like:
> >
> > self.canvas.mpl_connect('motion_notify_event', self.mouse_move_callback)
> >
> > then in mouse_move_callback:
> >
> > def mouse_move_callback(self, evt):
> >         xpos, ypos = evt.xdata, evt.ydata
> >         val = self.data[numpy.floor(xpos), numpy.floor(ypos)]
> >         status_str = "x: %4.2f  y: %4.2f   I:%4.2f" \
> >                   % (xpos, ypos, val)
> >         self.SetStatusText(status_str)
> >
> > where data is your image variable. This works in a wx.Frame object,
> > which has a SetStatusString method for displaying the values. I'm sure
> > you could find an equivalent in your traits app.
> >
> >
> Thanks, I'll look at this asap (as I got other stuff "on fire").
>
> BTW, I can't ever get (in fact, I don't know how) working
> the coords to be displayed in my traits app.
> I guess this is more related to traits, not to mpl.

For what it's worth, mpl embedded in wx also _requires_ the use of
motion_notify_event to get co-ordinates to display. It doesn't happen
by default except in stand-alone mpl as far as I can tell.

> But the "mpl embedded in traits app guru" is on holydays for now.
>
> Let's wait...
>
> Cheers,
>
> --
> http://scipy.org/FredericPetit
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


-- 
AJC McMorland, PhD Student
Physiology, University of Auckland

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to