plots not shown in Intellij when running code on server

Answered

In Intellij, plots are not displayed in the SciView Plot area on my PC when I run the code below on the Server (ssh connection).

The plot is correctly saved in my working directory on the server (myplot.png), but Intellij does not display it.

import numpy as np
Import matplotlib
import matplotlib.pyplot as plt

plt.plot(range(10))
plt.savefig ("myplot.png")
plt.display()

I've done the following:
1) I have selected Settings > Tools > Python Scientific > "Show plots in tool window"
2) In Putty, I have activated the X11-forwarding

But it still does not work.

0
10 comments

pyplot doesn't have display() method. Have you tried using show() instead?

import matplotlib.pyplot as plt

plt.plot(range(10))
plt.savefig("myplot.png")
plt.show()
0

sorry, a typo of mine, but I have plt.show() in my code but it does not work.

0

What PyCharm version do you use?
Please add logging following steps from the description of this issue https://youtrack.jetbrains.com/issue/PY-41267 and provide the whole console output.

0

I added the environment variable PYCHARM_DEBUG=True inside my Run configuration and hit Run, but I don’t get an additional consol output. I’m using Intellij 2020.2, is PYCHARM_DEBUG=True correct for Intellij? Or how do I get the output?

0

Yes, it also applies to IntelliJ. Perhaps you didn't enable Run with Python Console.

I've added it to the instruction.

0

Btw, you may need to update IntelliJ to the latest version before that.

0

„Run with Python Console“ is enabled in the Settings. I have Intellij 2020.2.1 and can‘t upgrade to a more actual version since I don‘t have the admin rights to do so.

0

Probably this logging was added later and it won't work in 2020.2.1. I'm afraid we can't troubleshoot it properly without this logging.
Could you ask the admin to update IntelliJ for you?

0

I‘ve updated Intellij to the latest version 2020.2.3, but I still don‘t see the log text in the console when running the code with environment variable PYCHARM_DEBUG=True.

0

Could you share a screenshot of your run configuration and the whole console output?

0

Please sign in to leave a comment.