我有一个gif,但我想淡化绘制的曲线.我已经读了this solution本,但我仍然需要帮助.目前,所有曲线都是相同的:
下面的代码为我生成gif:
import matplotlib
import imageio
def plot_for_offset(time, value):
ims = []
fig, axs = plt.subplots(figsize=(6,2.5))
for t, v in zip (time, value):
axs.plot(t, v, lw=1.0, color='k')
# Used to return the plot as an image rray
fig.canvas.draw() # draw the canvas, cache the renderer
image = np.frombuffer(fig.canvas.tostring_rgb(), dtype='uint8')
image = image.reshape(fig.canvas.get_width_height()[::-1] + (3,))
ims.append(image)
return ims
kwargs_write = {'fps':1.0, 'quantizer':'nq'}
import numpy as np
time = np.array([[0., 1., 2.], [0., 1., 2.], [0., 1., 2.]])
value = np.array([[0., 10., 20.], [20., 10., 0.], [10., 10., 10.]])
imageio.mimsave('animation.gif', plot_for_offset(time, value), fps=1.0)
现在,我想要淡化过go 出现的曲线.我非常感谢你们的帮助.