Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop showing plots in spyder

I have scripts that make lots of plots. I save them directly with plt.savefig() rather than plt.show() so I don't have to close all the windows. In spyder, they all show up in the console if I use inline (meaning I have to scroll way back to see other output), and they all show up in separate windows if I use automatic. I want them to not show up at all, because I'm not calling plt.show() ever. How can I do that?

nb: Both the suggested answers work! Thanks! I selected plt.ioff() as the correct answer since I can choose to do this for some scripts and not others.

like image 553
andbeonetraveler Avatar asked Nov 08 '18 22:11

andbeonetraveler


2 Answers

Maybe you want to turn spyder support for matplotlib off completely,

Preferences | IPython Consonle | Graphics | Support for Graphics

and untick Activate

enter image description here

like image 30
ImportanceOfBeingErnest Avatar answered Oct 20 '22 17:10

ImportanceOfBeingErnest


Try this (assuming imported pyplot as plt), at the start of the code somewhere:

plt.ioff()
like image 176
RichardBJ Avatar answered Oct 20 '22 17:10

RichardBJ