python - How to save image created with 'pandas.DataFrame.plot'? -
when trying save plot image created 'pandas.dataframe.plot' ' pandas.core.series.series' object :
%matplotlib inline type(class_counts) # pandas.core.series.series class_counts.plot(kind='bar', figsize=(20, 16), fontsize=26) like this:
import matplotlib.pyplot plt plt.savefig('figure_1.pdf', dpi=300) results in empty pdf file. how save image created 'pandas.dataframe.plot'?
try :
fig = class_counts.plot(kind='bar', figsize=(20, 16), fontsize=26).get_figure() fig.savefig('test.pdf')
Comments
Post a Comment