我試圖從matplotlib向pdf文件寫入一個圖,但出現錯誤。嘗試從Pandas DataFrame寫入matplotlib圖時發生錯誤pdf
我創建使用matplotlib從熊貓數據幀這樣一個情節:
bplot = dfbuild.plot(x='Build',kind='barh',stacked='True')
從文檔:
from matplotlib.backends.backend_pdf import PdfPages
pp = PdfPages(r'c:\temp\page.pdf')
figure = bplot.fig
pp.savefig(figure)
pp.close()
:
http://matplotlib.org/faq/howto_faq.html#save-multiple-plots-to-one-pdf-file
好像我應該這樣做它
我收到此錯誤:
AttributeError: 'AxesSubplot' object has no attribute 'fig'