【发布时间】:2021-03-05 11:37:57
【问题描述】:
我正在使用 pyplot.pcolor 和 mpl.ArtistAnimation 制作热图动画。它被调整为 1:1 的纵横比,并且边距设置得很紧。动画效果很好,当我在 python 中输出它时,它的裁剪和大小都很好,但是当我使用保存它时
animation=ArtistAnimation(fig1,list_of_figures,interval=400,repeat_delay=2000,blit=True)
f="c:/animations/myanimation.gif"
writergif=mpl.animation.PillowWriter(fps=10)
animation.save(f,writer=writergif)
它可以很好地保存和保持纵横比,但左右间隙很大,好像试图满足一些标准尺寸一样。如何解决这个问题?
【问题讨论】:
-
动画中的图像是 288 x 288 并且在 python 中输出。但是当我使用 PillowWriter 保存它时,它变为 432 x 288。我完全被难住了。
标签: python python-imaging-library gif