October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following steps explain how to code the required logic:
figmain, axmain = plt.subplots()figzoom, axzoom = plt.subplots()
axmain.set(xlim=(-5, 5), ylim=(-75, 175), autoscale_on=False, title='Click to zoom')axzoom.set(xlim=(-2, 2), ylim=(-8, 8), autoscale_on=False, title='Zoom window')
x = np.arange(-5, 5, 0.1)y = x ** 3
axmain.plot(x, y, 'g-d')axzoom.plot(x, y, 'b-.o')
def onbuttonpress(event): if event.button == 1: # left = 1, scroll=2, ...
Read now
Unlock full access