Search code examples
matplotlibspyderpython-idle

Why Matplotlib GUI changes in IDLE and Spyder?


I am using exactly the same code and environment but Matplotlib graphs in IDLE and Spyder have different GUI (graph options). Why is this happening? The version of matplotlib is 2.2.2, and Python is 3.6.8, Spyder 3.3.1.

Pictures are attached, so please refer to them. The area I marked have different options.

Matplotlib graph in IDLE

Matplotlib graph in Spyder

I actually would like to use graphs on ArcGIS but it appears with the IDLE one. I want to use the one from Spyder because it has few more options.


Solution

  • You use different Backends. In your case the GUI in IDLE is using "TkAgg", while the GUI in Spyder uses "Qt5Agg". The Backends user guide names 3 options to set the backend. Relevant for you are probably

    1. Set the backend via the backend parameter in your matplotlibrc file (see Customizing Matplotlib with style sheets and rcParams):

      backend : Qt5Agg   # use Qt5Agg with antigrain (agg) rendering
      
    2. Set the backend in the code

      import matplotlib
      matplotlib.use('Qt5Agg') 
      

      Those need to be at the start of your script before importing pyplot.

    In Spyder you can select the backend via the Tools/Preferences/IPython Console/Graphics/Graphics Backend option.

    enter image description here