Created
December 21, 2021 05:45
-
-
Save ven-kyoshiro/da075c0f41f8e891cbb1d7ba288f0659 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
import numpy as np | |
""" | |
marge two scatter animation | |
""" | |
fig = plt.figure() | |
x_base = np.random.randn(100) | |
ims = [] | |
for i in range(40): | |
x = x_base + i/10 | |
y1 = np.sin(x) | |
c1 = np.random.rand(100)/10 | |
c2 = np.random.rand(100)/10 | |
y2 = np.cos(x) | |
line =plt.scatter(x,y1,c=c1,s=10,alpha=0.4,cmap="rainbow",zorder=1,label="1") | |
line2 = plt.scatter(x,y2,c=c2,s=10,alpha=0.4,cmap="Greys",zorder=0,label="2") | |
plt.clim(0, 1) | |
ims.append([line,line2]) | |
plt.xlabel("labelkkkkkkk") | |
plt.hlines(0,0,1) | |
plt.yticks([0]) | |
plt.legend() | |
plt.colorbar(label="Frequency[Hz]") | |
ax = plt.gca() | |
ax.set_facecolor('black') | |
ani = animation.ArtistAnimation(fig, ims,interval=100) | |
ani.save(f'tmp_vis.mp4', writer="ffmpeg") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tmp_vis.mp4