Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Matplotlib – The graph does not show in Pycharm

I just started learning matplotlib. The code I used is here below:

import matplotlib.pyplot as plt

x = [1,2,3]
y = [2,4,6]

plt.plot([x, y])


The graph doesn’t show up. It just gets stuck. Is there a way to fix it?

I am a beginner matplotlibber, so I’m just following a tutorial, but this doesn’t work for me. I just simply want the graph to show up.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You missing the:

plt.show()

So your code become:

import matplotlib.pyplot as plt

x = [1,2,3]
y = [2,4,6]

plt.plot([x, y])
plt.show()

Or, if you are using a Jupiter Notebook:

%matplotlib inline
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading