Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spyder is ignoring matplotlib user settings #10932

Closed
10 tasks done
malfatti opened this issue Dec 5, 2019 · 4 comments · Fixed by #22088
Closed
10 tasks done

Spyder is ignoring matplotlib user settings #10932

malfatti opened this issue Dec 5, 2019 · 4 comments · Fixed by #22088

Comments

@malfatti
Copy link

malfatti commented Dec 5, 2019

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • 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 :)

@bcolsen
Copy link
Member

bcolsen commented Dec 5, 2019

I can confirm this.

If we offer an option to "Activate support", I guess it should disable interactive plotting when unchecked unless specified manually by the user.

Should we change "Activate support" to "Activate interactive plotting"?

@Dr-Piedra
Copy link

It would be helpful to have a command in terminal that disables this default behavior. I am running a Spyder version in a computer for which I am not the admin so I cannot update, and I don't have the "figures" pane, so I cannot disable the default behavior.

@Dhruvil42
Copy link

I'm using Spyder 4.1.1(just updated), my plots pane is not displaying any plot and showed not responding. I tried unchecking the mute inline but just doesn't work. The code gets executed but doesn't display plots.

@mrclary
Copy link
Contributor

mrclary commented May 18, 2024

I know this issue is old, but I've been making some updates to Spyder's graphics support; see #22088.

Regarding the OP. A Jupyter QtConsole defaults to inline graphics, even if a backend is specified in a user's matplotlibrc file (see screenshot below). I don't know if this is a bug or not, but since Spyder uses QtConsole, there is not anything we can do about it. However, with #22088, Spyder should no longer interfere with matplotlibrc settings if graphics support is disabled (uncheck Preferences->IPython console->Graphics->Activate support). This will be available for version 6.0.0.

Screenshot 2024-05-17 at 5 03 58 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants