如何使用matplotlib在jupyter笔记本中显示所有图形而不只是最后一个图形?

时间:2019-04-08 04:54:01

标签: pandas matplotlib jupyter-notebook

我想显示所有20张图,但只显示最后一张图。下面是代码:

#Lets take a serie with the number of times each ingredient was used

for cuisine in df_grouped.groups.keys():
df_cuisine = df_grouped.get_group(cuisine);

s = df_cuisine[list(all_ingredients)].apply(pd.value_counts).fillna(0).transpose()[True]

# Finally, plot the 10 most used ingredients

fig = s.sort_values(inplace=False, ascending=False)[:10].plot(kind='bar', title = cuisine)
fig = fig.get_figure()
fig.tight_layout()
fig.savefig(cuisine + '_10_most_used_ingredients.jpg')

0 个答案:

没有答案