【发布时间】:2022-06-22 04:11:46
【问题描述】:
我试图在我的流线型网站上绘制一个 gif,但它没有生成任何东西。它不会给出任何错误,它只是保持环境为空,就好像代码中没有运行任何内容一样。
下面我把我的代码responsabel 留给了 gif 的情节。
感谢您的帮助。
graph, = plt.plot([], [], color="gold", markersize=3, label='Tempo: 0 s')
L = plt.legend(loc=1)
plt.close() # Não mostra a imagem de fundo
def animate(i):
lab = 'Tempo: ' + str(round(dt*i * (rs_sun / 2.0) * 3e-5 , -int(math.floor(math.log10(abs(dt*(rs_sun / 2.0)*3e-5)))))) + ' s'
graph.set_data(x[:i], y[:i])
L.get_texts()[0].set_text(lab) # Atualiza a legenda a cada frame
return graph,
skipframes = int(len(x)/200)
if skipframes == 0:
skipframes = 1
ani1 = animation.FuncAnimation(fig, animate, frames=range(0,len(x),skipframes), interval=30, blit = True, repeat = False)
plt.show()
【问题讨论】:
标签: python matplotlib animation gif streamlit