Skip to content Skip to sidebar Skip to footer

Can I Prevent Spyder From Displaying Inline Images Temporarily?

In the Spyder IDE, I want to keep the inline console plotting (I don't want separate windows to spawn for each plot), but I want to programmatically disable plotting, i.e. in diffe

Solution 1:

Ok I think I found an answer, thanks to this answer;

https://stackoverflow.com/a/46360516/789215

The key was the python command for the line magics get_ipython().run_line_magic('matplotlib', 'inline'). I created a context manager to wrap my video frame for-loop;

from IPython import get_ipython

class NoPlots:
    def __enter__(self):
        get_ipython().run_line_magic('matplotlib', 'qt')
        plt.ioff()
    def __exit__(self, type, value, traceback):
        get_ipython().run_line_magic('matplotlib', 'inline')
        plt.ion()

Or is there a better approach?


Post a Comment for "Can I Prevent Spyder From Displaying Inline Images Temporarily?"