1

My program works fine when I view it in scientific mode, but I found that I cannot edit the plot in scientific mode, while I remember I can do that when the plot is displayed in a separate window. So I just disable the Python Scientific -> Show plots in tool window, then my program still runs with no error, but no figure is displayed. Because it can be displayed normally for the scientific mode, I don't think this is the problem of my program. It must be some setting for my PyCharm that went wrong. I have looked for the answers but most of those answers only address the problem of incorrect backend, apparently not applicable to my scenario.

I actually think PyCharm scientific view is more of a hindrance than a help. It reduces the original functionality for editing the plot and only leaves it with a rastered version of the plots.

enter image description here

In Scientific view it totally reduces the option to adjust the plot, while when I tried to disable the scientific view, nothing was displayed. This is quite annoying.

asked May 4, 2020 at 0:37

4 Answers 4

4

For me, pressing double shift, selecting python scientific and deselecting "Show plots in tool window" worked.

answered Jun 6, 2021 at 11:17

1 Comment

for me, I just uninstalled mpld3 and it worked again
3

try alternative matplotlib backends eg

import matplotlib.pyplot as plt
matplotlib.use('TkAgg') or
matplotlib.use('Qt5Agg')

Then turn interactive mode on in IDE by: plt.ion() # required for non notebook code from matplotlib .ioff() to turn off

then it should open the window with the plot rendered, PyCharm then pushes it to the background:

plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()

Worked for me

PyCharm: PyCharm 2021年1月1日 (Community Edition) Build #PC-211.7142.13, built on April 21, 2021 Runtime version: 11.0.10+9-b1341.41 amd64 VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: ParNew, ConcurrentMarkSweep Memory: 1972M Cores: 12 Registry: debugger.watches.in.variables=false Non-Bundled Plugins: String Manipulation (8.15.203.000.3), com.jetbrains.plugins.ini4idea (211.6693.44), izhangzhihao.rainbow.brackets (6.17), com.leinardi.pycharm.pylint (0.12.2), com.kite.intellij (1.9.3)

Python 3.8.10

Anaconda Nov 2020 - build x64 windows

answered Jul 8, 2021 at 12:11

2 Comments

If you don't want to have to add this line to every script that you use, you can find your matplotlibrc config file, which can be found with import matplotlib print(matplotlib.matplotlib_fname()) create a copy of it in User/<you>/.matplotlib/ , open it to edit it, and go to the part where it says "#bakend: " and change it to "backend: TkAgg"
And then if that doesn't work go into Settings > Tools > Python Scientific > and disable "Show plots in tool window"
2

try adding the line

import matplotlib.pyplot as plt
# Add this after you have done your plot
plt.show()
answered May 4, 2020 at 0:45

5 Comments

Thanks! But I am familiar with Matplotlib, this is not about the program. It's actually some issue of PyCharm IDE.
What backend are you using for matplotlib?
I basically tried all possible backends, but none of them works.
It reports no error, just doesn't display the fig if I unclick Show plots in tool window
Are you using anaconda? youtrack.jetbrains.com/issue/PY-29684
0

If you are receiving no error and you can not see your plot, check the items below:

  1. you have plt.show() at the very end.
  2. On the top right side of the pycharm IDE click on SciView and then click on plots. Sometimes your plot doesn't appear on the screen but is kept there.

Good Luck

answered Feb 2, 2023 at 4:07

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.