是否可以使用matplotlib动画图创建下拉列表?我有4 animated plots 并且我想将其中两个放在下拉列表(like this)中。
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
fig=plt.figure()
bits = np.random.randint(0,2,256)
bits2 = np.tile([0,1],128)
bits3=[1,1,1,1,1,1,1,1];
bits3=np.concatenate([bits3,np.tile(0,248)])
def animate(i):
fig.clear()
plt.plot(np.roll(bits,(i*-1))+6,'g', drawstyle='steps-mid',linewidth = 1)
plt.plot(np.roll(bits2,(i*-1))+4,'r', drawstyle='steps',linewidth = 1)
plt.plot(np.roll(bits3,(i*-1))+2,'r', drawstyle='steps',linewidth = 1)
plt.plot(np.roll(np.multiply(bits,bits3),(i*-1)),'r', drawstyle='steps',linewidth = 1)
plt.ylim([-1,8])
plt.gca().axis('off')
ani = animation.FuncAnimation(fig, animate, interval=50)
plt.show()