0

I'm trying to switch between plotting interactively and statically. I have a +3.0 Jupyter Lab environment that can make plots interactive using the magic command

%matplotlib widget

However there are times I'd like to plot statically. Restarting the kernel in the notebook is not an option as I have to run long computations. I don't use %matplotlib inline, I usually have a plotting function like:

def plotter(img):
    plt.figure(figsize=(12, 7))
    plt.imshow(img)
    plt.show()
    return

So I'm actually okay with not using magic commands

I see two approaches to this problem: either find a way to plot interactively without magic commands or find a way to turn on and off magic commands. I haven't been able to find either. Docs on https://github.com/matplotlib/ipympl aren't helpful. And it seems like magic commands can be turned off entirely, but not at will (at least from my searching). Any advise on tackling these solutions would be deeply appreciated.

Kevin M
  • 158
  • 10

0 Answers0