Reputation: 3
I recently downloaded python on my new computer, however when I try to plot something in matplotlib the plot doesn't show. Even the example beneath doesn't work. I am running this in spyder via anaconda.
import matplotlib.pyplot as plt
x=[1,2,3]
y=[2,3,4]
plt.plot(x,y)
plt.show()
What can I do?
EDIT: I figured it out, it was just a simple problem. If you struggle with the same, make sure you have checked off for plots when going to View - Panes - plots or press shift + cmd + G on mac.
Upvotes: 0
Views: 1000
Reputation: 96
Your code is fine. This is probably an issue with your IDE. You might want to ask this question with regards to the specific IDE you are using. For example if you ran this is Jupyter notebook the issue might be solved with a %matplotlib inline
If you are running it on the python shell itself an external window should appear displaying your plot. If you are using an IDE like pycharm you might need to configure certain settings to get the external window to appear.
Hope this helps!
Upvotes: 1