Why when I Use ZooM, On-Pick Event don't correspond to my plots datas

Hello,

I send this message because I have a problem with "On-Pick" Funtion.
When I use this function with my datas, cartesian coordinates don't
correspond.
Seems to work with the example, but not with my data, somebody knows why ?
Thanks you for your reply !!!

My code :

"""
compute the mean and stddev of 100 data sets and plot mean vs stddev.
When you click on one of the mu, sigma points, plot the raw data from
the dataset that generated the mean and stddev
"""
import numpy as np
import matplotlib.pyplot as plt

compteurdata = 0
positif = 0
datas = [0]
myrange = []
xs = range(2500)

chemin = "C:/Users/utilisateur/Desktop/ProtoData/1902-1/plotcolonne.txt"
fichier = open(chemin,'r')

# 5 points tolerance
#declaration de variables

# Lecture de la table
        
for l in fichier.readlines():
   if compteurdata < 2499 :
       l = float(l)
       datas.append(l)
       compteurdata = compteurdata + 1
   else:
      pass
      
ys = datas

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

def onpick(event):

    if event.artist!=line: return True
    N = len(event.ind)
    
    if not N: return True
    print xs[event.ind],ys[event.ind]

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

plt.show()

···


View this message in context: http://old.nabble.com/Why-when-I-Use--ZooM%2C-On-Pick-Event-don't-correspond-to-my-plots-datas-tp28433072p28433072.html
Sent from the matplotlib - users mailing list archive at Nabble.com.