如何保存使用'pandas.DataFrame.plot'创建的图像?
- 论坛
- 如何保存使用'pandas.DataFrame.plot'创建的图像?
8 浏览
如何保存使用'pandas.DataFrame.plot'创建的图像?
当尝试将使用'pandas.DataFrame.plot'创建的图像保存为'pandas.core.series.Series'对象时:
%matplotlib inline type(class_counts) # pandas.core.series.Series class_counts.plot(kind='bar', figsize=(20, 16), fontsize=26)
像这样:
import matplotlib.pyplot as plt plt.savefig('figure_1.pdf', dpi=300)
结果是空的pdf文件。如何保存使用'pandas.DataFrame.plot'创建的图像?