1
votes

I've recently started using sublimetext 3, the plt.show() function doesn't seem to work when run within sublimetext.

I have create the following script:

import matplotlib.pyplot as plt
year = [1950, 1970, 1990, 2010]
pop = [2.519, 3.692, 5.263, 6.972]
plt.plot(year, pop)
plt.show()

Running this with IDLE generates a plot, however using sublimetext no output is generated.

I use the following build system

{
    "cmd": ["/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "shell": true
}

If someone can please tell me what i am doing wrong, because i don't see any build errors but i still don't see any graph.

If someone could please help in this regard - Thanks

3

3 Answers

1
votes

Sublime is great, but doesn't do well with certain things (eg, input() and Kivy displays, among other things).

Try using another IDE such as Spyder. (Your sample code renders just fine for me.)

1
votes

For Windows: I recently had a problem loading a map on the screen. After many tries, I got a simple solution...running the python program by the cmd prompt. This way, the map just popped up on my screen. I still using sublime text becouse for me is the better editor, very light and fast.

0
votes

Mostly, you are not using Sublime Text 3.0

You can Download 3.0 version then download the package (For Mac, Press Command+Shift+P -->Package Control: Install Package)

It will definitely work after that. Here is the graph plotted using your code.Plot Image