我试图从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'