有办法不显示使用Matplotlib FuncAnimation生成的.PNG图像。可以通过设置Matplotlib的interactive模式为False来实现。具体步骤如下:
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig = plt.figure()
def update(frame):
# 在这里生成动画帧的内容
# 返回动画帧的对象
return frame
ani = animation.FuncAnimation(fig, update, frames=100, interval=50)
plt.interactive(False)
ani.save('animation.png', writer='pillow')
通过以上步骤,使用Matplotlib FuncAnimation生成的PNG图像将被保存到'animation.png'文件中,而不会在程序中显示出来。
请注意,以上步骤中未提及具体的腾讯云产品和链接地址,因为没有与问题相关的特定产品和链接。如果有特定的腾讯云产品需求或者其他问题,欢迎提问。
没有搜到相关的沙龙
领取专属 10元无门槛券
手把手带您无忧上云