Pycharm: plt.imshow() is not displaying image in sciview

HI,

I am a new pycharm professional user. I am trying to visualize the image using matplotib function (plt.imshow()). But, unfortunately, the image is not being displayed. I am unable to resolve this issue even after setting "DISPALY=TRUE" in run configuration settings. 

But strangely the following example in Pycharm Doc "https://www.jetbrains.com/help/pycharm/matplotlib-tutorial.html" works perfectly fine and displays image. Also the scientific mode is enabled always.

Please, kindly help me to resolve this. 

 

 

8 comments

Hello!
Thank you for contacting PyCharm support.

Are you able to view Data for some other variables in your code (the field where you currently type 'image')?

Looking forward to your reply.

0

Sorry, I haven't noticed that you have a console opened.

PyCharm is currently trying to take it from Console, instead of Debugger.

Please close the console and try again, it should work.

0

HI Karpov,

 
Thanks for your kind reply. I closed the console but unfortunately, the image still doesn't display. I bit confused with the issue. I have attached a screenshot also.
Please, kindly help me.
 
Thanking you,
Chetan
0

Hi,

Thank you for the update.

Have you tried to stop the debugger and run it again? I cannot see the the field for data and Format, which is quite strange.

Please try the following:
1) Stop the debugger and close all the tabs and SciView window.

2) Remove the breakpoints.

3) File | Invalidate Cashes / Restart...

4) Wait for the indexing completion and run your code with Ctrl+Shift+F10 (⌃⇧R for Mac OS).

5) Set the breakpoint and run a debugger.

Please let me know the result.

Regards,

Sergey

https://www.jetbrains.com

The Drive to Develop

0

i have a similar / the same problem. I am not quite sure.

Intellij shows the message when i try to display a plot with plt.show()

[..] python3.6/site-packages/matplotlib/figure.py:445: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  % get_backend())

When i try so use another backend the plt.show() function than either throws a long stack, which end displays:

"AttributeError: 'NoneType' object has no attribute 'session'",

or opens a figure, but does not really show anything.

When i run the code as a Program and with the GTK3Cairo backend, the picture actually opens. This backend however does not work in the console.
However i like working with the python3 console, any advice?

 

0

Please try running your script from the system terminal (outside of PyCharm) using the same interpreter. What's the result?

Please make sure to you exactly the same interpreter as in PyCharm, it is important.

0

Same output, same result.

Btw. i am using the IntelliJ Ultimate Edition...

0

Thanks!

Having the same result outside of PyCharm means that the problem is actually not related to PyCharm. You should locate the problem in your system. Try googling your error output.

0

Please sign in to leave a comment.