Interactive plots in Jupyter Notebook
You can draw an interactive plot in Jupyter Notebook (with matplotlib) if you run this code before drawing the plot:
1
%matplotlib notebook
The interactive plot looks like this and supports zooming:

Note that you must run this line before every interactive plot you want to create. Also, the plot remains interactive until you call “%matplotlib notebook” again, change the mode to inline (“%matplotlib inline”) or quit the interactive mode by clicking the button in the top right corner of the plot.
If you draw a second plot while one of you plots is interactive the command will add another dataset to the existing plot instead of creating a new one:

Did you enjoy reading this article?
Would you like to learn more about leveraging AI to drive growth and innovation, software craft in data engineering, and MLOps?
Subscribe to the newsletter or add this blog to your RSS reader (does anyone still use them?) to get a notification when I publish a new essay!
You may also like

Bartosz Mikulski
- MLOps engineer by day
- AI and data engineering consultant by night
- Python and data engineering trainer
- Conference speaker
- Contributed a chapter to the book "97 Things Every Data Engineer Should Know"
- Twitter: @mikulskibartosz
- Mastodon: @mikulskibartosz@mathstodon.xyz