4

I run

import matplotlib.pyplot as plt
plt.plot(range(0, 10, 1)) #or "plt.plot(range(10))"
plt.show()

and it does nothing (except saying "Process finished with exit code 0" ). I am using PyCharm, on Windows 7, I installed matplotlib via PyCharm's package manager. I installed python 2.7 and PyCharm today (I practiced it for a month at codecadamy.com but I wanted to get accustomed to real conditions), so I am noob, and it can happen that the problem is trivial.

I tried various codes at matplotlib.org with no results.

4
  • Process finished with exit code 0 means that it executed without an error. It's strange that a pop-up window doesn't appear. Try saving the figure using plt.savefig and checking if it did. Additionally show was intended to be used as a script more than as an interactive plot. Are you running that as a script or from some IDE/IDLE/REPL (write a command press enter...)? Try using plt.ion() and then repeating the commands to see if a plot appears. Disclaimer though, I don't use PyCharm. Commented May 7, 2015 at 17:34
  • I am running it as a script. I tried plt.ion(), nothing happens. I tried plt.savefig("image.png") it did not save it (i checked in the folder where the whole project is). Commented May 7, 2015 at 17:52
  • are you sure it saved it there? Can you write import os at the top and then print(os.path.abspath(os.path.curdir) right before you do the plt.savefig. The path it prints out is the one where the image is saved. If that doesn't work the best I can do for you is direct you to PyCharm help forums Commented May 7, 2015 at 18:13
  • I just run the wrong script, i did not expect that it would run old script if this one is opened. Commented May 7, 2015 at 18:17

2 Answers 2

1

Ok, apparently i made the stupidest mistake ever. I had multiple tabs opened, and I constantly run the first one, instead of the one i should have. Should I delete question? I'm so embarrassed.

Sign up to request clarification or add additional context in comments.

2 Comments

don't delete it, just mark your own answer correct and let it go. I think there's a time period of 48h before you can do that but I'm not sure.
Please delete it. I voted to close. Keeping this question around won't help anyone. It will only waste people's time who are having a real problem that happens to hit on the same key words.
0

You can try uninstalling python, and reinstalling again.

Or check out this link, it's similar to your question: matplotlib plot window won't appear

1 Comment

Thanks for response, i saw that link already. I turned out I made the stupidest mistake possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.