I am trying to change the underlying data for my plot via a pick event,
except that the matplotlib examples for picking show a couple of functions
with predefined signatures and I can't seem to figure out how to modify my
data from within those functions...how to do it? 

Here is a minimal example of what I am trying to do:

[code]
import matplotlib.pyplot as plt

def pick_rlines(art,mouseevent):
   button = mouseevent.button
   key = mouseevent.key
   
   wsf.nnn = 4          # <-- how to modify wsf.nnn from here?
   print "wsf.nnn = ", wsf.nnn
   props = dict(nnn=wsf.nnn)
   return True, props 
       
def pick_handler(event):
   mouseevent = event.mouseevent
   button = mouseevent.button
   key = mouseevent.key
   art = event.artist
  
   wsf.nnn = event.nnn  # <-- or from here ?
      
class AAA():
   pass

class BBB():     
   def __init__(self):
      pass
      
   wsf=AAA()            # when it is defined here?
   wsf.nnn=0
   GR = [1.0, 2.0, 3.0, 4.0]

   fig = plt.figure()
   ax = fig.add_axes([0.1,0.1,0.75,0.75])
   ax.set_aspect(1)         
   rlines = ax.hlines(GR,0.0,4.0,picker=pick_rlines)   
   fig.canvas.mpl_connect('pick_event', pick_handler)            
   plt.show()

if __name__ == '__main__':
   the = BBB()
   
[/code]

thanks in advance for any pointers.
-- 
View this message in context: 
http://old.nabble.com/access-to-my-underlying-data-from-picker-of-pick_handler-tp33492013p33492013.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to