On Fri, Apr 24, 2009 at 4:09 AM, fjldurodie <frederic.duro...@gmail.com> wrote:
> Hi,
>
> Thanks for your reply :
>
> I think I will try and follow your last suggestion by passing a callback
> function that is defined through another function (this is because the
> program generates a series of figures that are all similar) :
>
> def gen_onselect(ax):
>   def onselect:
>      # do the stuff here that requires to know which axes
>   return onselect
>
> and then use
>
> span = SpanSelector(ax, gen_onselect(ax), 'horizontal', useblit=True,
>                   rectprops=dict(alpha=0.25, facecolor='blue') )
>

I think this is common practice in event handling.

The partial function can be handy.

http://docs.python.org/library/functools.html

Regards,

-JJ



> I'll let you know if this works or not.
>
> Kind regards,
> Frederic
>
> Jae-Joon Lee wrote:
>>
>> On Mon, Apr 20, 2009 at 4:09 PM, fjldurodie
>> <frederic.duro...@googlemail.com> wrote:
>>
>>>
>>> Hi,
>>>
>>> I'm wondering if it is possible to use SpanSelector on multiple figures
>>> : my problem is that I can't think of a way to tell the onselect on
>>> which axes(ses) of which figure it should try and do something. The
>>> example works because there is only one SpanSelector active and "it"
>>> therefore knows which axes "it" should redraw.
>>>
>>> For it to work on multiple figures (say I have a series of events that I
>>> plot in a similar way each in a separate figure and I would like a
>>> SpanSelector feature on each of the figures) I would need to have a
>>> reference to which axes called the onselect through SpanSelector : then
>>> I could get the axes's figure and manipulate the other subplots on that
>>> figure accordingly.
>>>
>>
>> Mouse event in mpl has a "inaxes" property. However, SpanSelector hide
>> event information from users.
>>
>> On the other hand, the first argument of the SpanSelector is the
>> "axes" that you want to use. So, I'm not sure what your point is. You
>> already know the axes you're working with. Can't you just use
>> different callbacks for different axes?
>>
>> -JJ
>>
>>
>>
>>>
>>> Is there a way of doing this ?
>>>
>>> Kind regards,
>>> Frederic
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Stay on top of everything new and different, both inside and
>>> around Java (TM) technology - register by April 22, and save
>>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
>>> 300 plus technical and hands-on sessions. Register today.
>>> Use priority code J9JMT32. http://p.sf.net/sfu/p
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Stay on top of everything new and different, both inside and around Java
>> (TM) technology - register by April 22, and save
>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
>> 300 plus technical and hands-on sessions. Register today. Use priority
>> code J9JMT32. http://p.sf.net/sfu/p
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to