Closed
Description
Handling pick events does not work on logarithmic axes. See the example below. As long as the line statement ax.set_xscale('log')
is commented out, clicking on the polygons created by axvspan
xauses them to change from gray to red. Uncomment that line to make the x axis logarithmic, and clicking on the polygons has either no effect or is misdirected to the far-left polygon only.
from matplotlib import pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_xlim(1, 10)
for i in range(1, 10, 3):
ax.axvspan(i, i + 1, color='gray', picker=True)
# uncomment this line to break the picker
# ax.set_xscale('log')
def onpick(event):
event.artist.set_color('red')
fig.canvas.draw()
fig.canvas.mpl_connect('pick_event', onpick)
plt.show()
Tested on version 1.4.0 and master as of 04496b0 on Mac OS X Mavericks.
[TAC edited for formatting]