I'm trying to use matplotlib to get an x point on some figures by mouse
  clicking.
  To do this I try the next example:
  -------------------------
  datax=[]
  datay =[]
  def click(event):
      x, y = event.x, event.y
      if event.button == 1:
          if event.inaxes:
              print 'data coords: ', event.xdata, event.ydata
              datax.append(event.xdata)
              datay.append(event.ydata)
      if event.button == 3:
          pylab.close()
      return datax,datay
  fig = pylab.figure(figsize=(8,6))
  ax = fig.add_subplot(111)

- Ignored:
  ax.plot(pylab.arange(10))
  cursor = Cursor(ax, useblit=False, color='red', linewidth=2)
  cursor.horizOn = False

  pylab.connect('button_press_event', click)

  pylab.show()
  pylab.disconnect(click)
  print 'los arrays de data son: ', datax,datay
  ------------------------------------------------------

  My problem is tha I want to only be able to click each figure once, then
  lock the
  figure (making it unclickable), close it and open another one. But I'm
not
  able to
  implement this.
  Anyone have any suggestions?.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to