出于某种原因,我一直保存一个空白文件。
import os
from numpy import arange, sin, pi , cos
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
from matplotlib import pyplot
import sys
import pylab
class App:
def __init__(self,master, df):
frame = Frame(master)
frame.grid(row = 0, column = 0)
series = df['Daily T'].cumsum()
self.f = Figure(figsize=(12,6), dpi=100, linewidth=2)
chart = self.f.add_subplot(111)
chart.grid(True)
chart.plot(series, 'r-o')
chart.set_xticks(range(0,len(series),10))
self.f.autofmt_xdate()
try:
#pyplot.savefig('chart.pdf')
print 'saved as chart.pdf'
except Exception, e:
print str(e)