Reputation: 1
I'm following the tutorial video linked here: http://www.youtube.com/watch?v=wAwQ-noyB98
I installed Matplotlib, including the other necessary libraries: numpy, dateutil, pytz, pyparsing, and six.
Now, I'm trying the following command(s):
import matplotlib.pyplot as plt
plt.plot([1,2,3,4,5,6,7],[5,6,7,8,9,10,11])
I'm expecting some sort of graphic to appear, but nothing happens(?) If I try:
print plt.plot([1,2,3,4,5,6,7],[5,6,7,8,9,10,11])
I get [matplotlib.lines.Line2D object at 0x03047510]
So it looks like something is being created, it's just not an image file. Any Idea what I'm doing wrong? Thanks in advance.
Upvotes: 0
Views: 154
Reputation: 53668
You've created a graphic of your plot but you haven't told matplotlib to show it yet. Your full code should be something like:
import matplotlib.pyplot as plt
plt.plot([1,2,3,4,5,6,7],[5,6,7,8,9,10,11])
plt.show()
Matplotlib doesn't plot each graph as you plot it as plotting can be computer intensive, as such it holds off until the user chooses to show them using the show
method (docs).
Upvotes: 3