spyder icon indicating copy to clipboard operation
spyder copied to clipboard

Spyder is ignoring matplotlib user settings

Open malfatti opened this issue 5 years ago • 4 comments

Issue Report Checklist

  • [X] Searched the issues page for similar reports
  • [X] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [X] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [X] Could not reproduce inside jupyter qtconsole (if console-related)
  • [X] Tried basic troubleshooting (if a bug/error)
    • [X] Restarted Spyder
    • [X] Reset preferences with spyder --reset
    • [X] Reinstalled the latest version of Anaconda
    • [X] Tried the other applicable steps from the Troubleshooting Guide
  • [X] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

If I uncheck "Activate support" under Tools > Preferences > IPython > Graphics, my plots are still going to the plot pane, and not to a separate plot window. In previous versions, I always had the graphics support disabled and handled all matplotlib stuff externally, and it always worked perfectly. Now, even with the environmental variable "MPLBACKEND" set to "TkCairo" and the backend set in matplotlibrc, I still get this:

In [1]: import matplotlib.pyplot as plt

In [2]: plt.get_backend()
Out[2]: 'module://ipykernel.pylab.backend_inline'

If I instead import it like this:

In [1]: from matplotlib import rcParams

In [2]: rcParams.update({'backend': 'TkCairo'})

In [3]: from matplotlib import pyplot as plt

In [4]: plt.get_backend()
Out[4]: 'TkCairo'

everything seems fine, but plots are still shown as non-vectorial images in the plot pane


In [5]: plt.plot([1,2,3,4,3,2,1])
Out[5]: [<matplotlib.lines.Line2D at 0x7f21f36ff750>]

Figures now render in the Plots pane by default. To make them also appear inline in the Console, uncheck "Mute Inline Plotting" under the Plots pane options menu. 

If I activate IPython graphics support and select Tkinter as backend, it works as expected, except that it do not wait for the plt.show() call.

What steps reproduce the problem?

  1. Set matplotlib backend as anything but inline in MPLBACKEND and/or matplotlibrc
  2. Disable IPython graphics support
  3. import matplotlib.pyplot as plt
  4. plt.plot([1,2,3])

What is the expected output? What do you see instead?

Expected: no output until plt.show() is called, and when it is, a separate window pop out showing the vectorial plot. Observed: rendered non-vectorial plot is immediately shown in the plot pane.

Versions

  • Spyder version: Spyder 4.0.0rc3
  • Python version: Python 3.7.5 64-bit
  • Qt version: Qt 5.9.6
  • PyQt version: PyQt5 5.9.2
  • Operating System name/version: Gentoo GNU/Linux

Dependencies

cloudpickle >=0.5.0          :  1.2.2 (OK)
pygments >=2.0               :  2.4.2 (OK)
qtconsole >=4.6.0            :  4.6.0 (OK)
nbconvert >=4.0              :  5.6.1 (OK)
sphinx >=0.6.6               :  2.2.1 (OK)
pylint >=0.25                :  2.4.4 (OK)
psutil >=0.3                 :  5.6.5 (OK)
qtawesome >=0.5.7            :  0.6.0 (OK)
qtpy >=1.5.0                 :  1.9.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
zmq >=17                     :  18.1.0 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
numpydoc >=0.6.0             :  0.9.1 (OK)
spyder_kernels >=1.8.0;<2.0.0:  1.8.0 (OK)
qdarkstyle >=2.7             :  2.7 (OK)
atomicwrites >=1.2.0         :  1.3.0 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
intervaltree                 :  None (OK)
watchdog                     :  None (OK)
keyring                      :  None (OK)
pexpect >=4.4.0              :  4.7.0 (OK)
pympler                      :  None (OK)
sympy >=0.7.3                :  None (NOK)
cython >=0.21                :  None (NOK)
IPython >=4.0                :  7.9.0 (OK)
matplotlib >=2.0.0           :  3.1.2 (OK)
pandas >=0.13.1              :  None (NOK)
numpy >=1.7                  :  1.17.4 (OK)
scipy >=0.17.0               :  1.3.3 (OK)
pyls >=0.31.1;<0.32.0        :  0.31.1 (OK)
xdg >=0.26                   :  0.26 (OK)
rtree >=0.8.3                :  0.8.3 (OK)

Btw, I loved the new features and visual of those 4.0 releases, thanks a lot for all the work in this amazing IDE :)

malfatti avatar Dec 05 '19 12:12 malfatti