r/IPython • u/[deleted] • May 21 '15
try "%matplotlib notebook" for interactive plots
I didn't know about this until recently.
EDIT: Nothing too fancy, but it adds MATPLOTLIB backend screenshot, so that you can move, zoom, resize, and save.
32
Upvotes
9
u/jakevdp May 21 '15
Some details, based on some of the questions in this thread:
The old
%matplotlib inlineactivates the inline backend, which renders figures in the notebook as static pngs.The new
%matplotlib notebookactivates the nbagg backend, added in matplotlib 1.4, which will include a javascript interface for interaction with inline figures in the notebook. This only works in IPython 3.x; for older IPython versions, use%matplotlib nbaggnbagg is different than mpld3 in that it requires a live connection to a Python kernel. This allows it to be more feature complete than mpld3, but any static rendering of the notebook will not include the interactivity.
Hope that clarifies things!