On Nov 7, 2007 7:17 AM, Michael Droettboom <[EMAIL PROTECTED]> wrote:

Michael> I'm not sure what you mean by "can't work on my canvas".  Can you
Michael> provide a small code sample that shows it not working?

Sunzen,

Here is a reference example in which the x and y constrained panning
do work in my tests with (GTKAgg and mpl svn), and picking is enabled,
so you might start and see if this works for you and if not what is
different about your code.  Note that you can only have *either*
panning and zooming enabled, or picking, but not both at the same
time, because both compete for the resource of the mouse via the
widget lock.

import numpy
from pylab import figure, show

X = numpy.random.rand(100, 1000)
xs = numpy.mean(X, axis=1)
ys = numpy.std(X, axis=1)

fig = figure()
ax = fig.add_subplot(111)
ax.set_title('click on point to plot time series')
line, = ax.plot(xs, ys, 'o', picker=5)  # 5 points tolerance


def onpick(event):

    if event.artist!=line: return True

    N = len(event.ind)
    if not N: return True


    figi = figure()
    for subplotnum, dataind in enumerate(event.ind):
        ax = figi.add_subplot(N,1,subplotnum+1)
        ax.plot(X[dataind])
        ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]),
                transform=ax.transAxes, va='top')
        ax.set_ylim(-0.5, 1.5)
    figi.show()
    return True

fig.canvas.mpl_connect('pick_event', onpick)

show()

Sunzen> I'm sad to see that there is no answer to my question over these days.
Sunzen> Active development of matplotlib needs a lot of users.

Absolutely true.  We have several active developers, and many more
users, so developers tend to prioritize their responses to questions
which provide a clear description of the problem (with version and
environment information) and more importantly, a code sample so we can
see whether we can replicate the problem on our end.  When a user
doesn't take the time to prepare such a post so that we can help him
effectively, we tend to move on.

JDH

JDH

-------------------------------------------------------------------------
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