Commit 295314ba authored by Yan's avatar Yan
Browse files

added autoscale on doubleclick

parent 5e852242
......@@ -53,7 +53,13 @@ def zoom_factory(ax, base_scale, plot=None, an=None):
def pan_factory(ax, plot=None, an=None):
def pan_fun(event):
if event.button == 1 and event.inaxes == ax:
if event.dblclick and event.inaxes == ax:
ax.get_figure()
ax.autoscale(True)
ax.set_ylim(ax.get_ylim()[1]*-0.01,ax.get_ylim()[1]*1.1)
ax.figure.canvas.draw()
print("doubleclick")
elif event.button == 1 and event.inaxes == ax:
ax.start_pan(event.x, event.y, event.button)
id_drag = fig.canvas.mpl_connect('motion_notify_event', drag_fun)
id_release = fig.canvas.mpl_connect('button_release_event',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment