我正在尝试将数据框绘制为表格并将其保存为pdf。我可以使用此示例https://matplotlib.org/examples/pylab_examples/multipage_pdf.html将图形保存为pdf。我还可以绘制所需的表格,但不能将其保存为pdf。 :
我正在尝试
fig_stats = plt.figure(figsize=(12, 9))
fig_stats = ff.create_table(df_stats)
plt.title('Derived features')
#txt = 'this is an example'
plt.text(0.05, 0.95, txt, transform=fig_stats.transFigure, size=24)
pdf.savefig()
plt.close()
但是我不允许将其保存为pdf,但出现AttributeError:'Figure' object has no attribute 'transFigure'
我也尝试过用Matplotlibs自己的表生成器,但是都行不通。我非常感谢能够使用PdfPages包,因为我还需要在同一pdf中绘制一些图形。关于我在做什么错的任何想法吗?预先感谢