In [1]:
import os
import sys
# check the scripts directory is present
if not os.path.exists("../scripts/"):
    print "The scripts directory is missing"
    sys.exit()
# since the scripts directory is there, try importing the modules
sys.path.append('../scripts')
import dateutil
import qcio
import qcutils
import qcts
import qcplot
import statsmodels.api as sm

In [2]:
import matplotlib.pyplot as plt

In [3]:
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('click on points')

line, = ax.plot(np.random.rand(100), 'o', picker=5)  # 5 points tolerance

def onpick(event):
    thisline = event.artist
    xdata = thisline.get_xdata()
    ydata = thisline.get_ydata()
    ind = event.ind
    print 'onpick points:', zip(xdata[ind], ydata[ind])

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

plt.show()


onpick points: [(73.0, 0.19439319526163945)]
onpick points: [(73.0, 0.19439319526163945)]
onpick points: [(86.0, 0.26059518850460106)]
onpick points: [(85.0, 0.37306043241727682)]
onpick points: [(69.0, 0.56170384971966592)]
onpick points: [(14.0, 0.53225699534750881)]
onpick points:

In [ ]: