An example with multiple plots using the grafica library:
Drag the mouse over the first plot to pan in any direction.
Click left/right in the second and fourth plots to zoom/un-zoom.
Click in the third plot to recenter.
Credits for the beer mug:
Check the p5.js version here: