Thanks for this discussion, I am trying to the same for my application but I have to do this for several images sequentially, So I tried the same but in a for loop, for eg:
for i_ in range(2):
fig, ax = plt.subplots()
# ax.add_artist(ab)
for row in range(1,30):
tolerance = 30 # points
ax.plot(np.arange(0,15,0.5),[i*row/i for i in range(1,15*2+1)], 'ro-', picker=tolerance, zorder=0)
fig.canvas.callbacks.connect('pick_event', on_pick)
klicker = clicker(ax, ["event"], markers=["x"], **{"linestyle": "--"})
plt.draw()
plt.savefig('add_picture_matplotlib_figure_{i_}.png',bbox_inches='tight')
plt.show()
But i get the click functionality only for the last image. How can i get it done for all the images?