This directory contains two companion notebooks, one that consolidates the code, and one that goes step by step to match the article Creating a Python Interactive Plot Using Matplotlib in Jupyter.
See that article for complete usage directions, but basic usage is to create a virtual environment, then into it, pip install -r requirements.txt.