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:

%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:

Remember to share on social media!
If you like this text, please share it on Facebook/Twitter/LinkedIn/Reddit or other social media.

If you want to contact me, send me a message on LinkedIn or Twitter.

Would you like to have a call and talk? Please schedule a meeting using this link.

Bartosz Mikulski
Bartosz Mikulski * data/machine learning engineer * conference speaker * co-founder of Software Craft Poznan & Poznan Scala User Group

Subscribe to the newsletter and get access to my free email course on building trustworthy data pipelines.

Do you want to work with me at riskmethods?

REMOTE position (available in Poland or Germany)