我试图保存使用for循环创建的散点图:
for i in df["Canal de distribution"].unique():
fig, ax = plt.subplots(figsize=(10,7))
ax.scatter(df[df["Canal de distribution"]==str(i)]["date"],df[df["Canal de distribution"]==str(i)]["Prix"],alpha=.7)
fig.savefig("distribution données canal : {} .png".format(i), transparent=False, dpi=300,bbox_inches='tight', facecolor=(1,1,1,0))
plt.show()创建了图表,但没有保存任何数据。知道我错过了什么吗?
编辑:我注意到保存了一个名为“分发唐内斯运河”(与Save图相同)的文件,但没有任何扩展,只有一个奇怪的地方。
发布于 2020-07-05 21:23:49
使用alaniwi的输入,我从savefig标题中删除了冒号,它起了作用
发布于 2020-07-05 21:08:27
更改:
fig.savefig("distribution données canal : {} .png".format(i), transparent=False, dpi=300,bbox_inches='tight', facecolor=(1,1,1,0))至:
plt.savefig("distribution données canal : {} .png".format(i), transparent=False, dpi=300,bbox_inches='tight', facecolor=(1,1,1,0))https://stackoverflow.com/questions/62746301
复制相似问题