The Python Oracle

Pycharm does not show plot

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Puzzle2

--

Chapters
00:00 Pycharm Does Not Show Plot
00:58 Answer 1 Score 38
01:12 Answer 2 Score 69
01:55 Answer 3 Score 39
02:18 Answer 4 Score 39
02:27 Thank you

--

Full question
https://stackoverflow.com/questions/2488...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #matplotlib #pycharm

#avk47



ANSWER 1

Score 69


I realize this is old but I figured I'd clear up a misconception for other travelers. Setting plt.pyplot.isinteractive() to False means that the plot will on be drawn on specific commands to draw (i.e. plt.pyplot.show()). Setting plt.pyplot.isinteractive() to True means that every pyplot (plt) command will trigger a draw command (i.e. plt.pyplot.show()). So what you were more than likely looking for is plt.pyplot.show() at the end of your program to display the graph.

As a side note you can shorten these statements a bit by using the following import command import matplotlib.pyplot as plt rather than matplotlib as plt.




ANSWER 2

Score 39


I tried different solutions but what finally worked for me was plt.show(block=True). You need to add this command after the myDataFrame.plot() command for this to take effect. If you have multiple plot just add the command at the end of your code. It will allow you to see every data you are plotting.




ANSWER 3

Score 39


import matplotlib
matplotlib.use('TkAgg')

Works for me. (PyCharm/OSX)




ANSWER 4

Score 38


I had the same problem. Check wether plt.isinteractive() is True. Setting it to 'False' helped for me.

plt.interactive(False)