Hi fred,
On 04/08/07, fred <[EMAIL PROTECTED]> wrote:
> Well, running mpl examples (say image_demo.py),
> you can see the point coordinates under the pointer.
> Good point ;-)
>
> I would like to have the scalar value under the pointer to be displayed
> too.
>
> How could I do this ?
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.
Hope that helps,
Gus.
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users