Python matplotlib Pages - 1 2
Download Python Project : Py-fig-Scater.zip - (108 KB zip file) Download
Source Code of Python Project - Py-fig-Scater :
Download this Source Code at python file: Py_fig_Scater.py - (1.31 KB Python file) download
Output of Py-fig-Scater project, Drawing animated GIFs with matplotlib or Animline Seaborn Line:
Download Python Project : Py-Scater-animate.zip - (15.3 KB zip file) Download
Source Code of Python Project - Py-Scater-animate :
Download this Source Code at python file: Py_Scater_animate.py - (686 Byte Python file) download
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
fig, ax = plt.subplots()
ax.set_xlim([0, 10])
scat = ax.scatter(1, 0)
x = np.linspace(0, 10)
def animate(i):
scat.set_offsets((x[i], 0))
return (scat,)
ani = animation.FuncAnimation(fig, animate, repeat=True, frames=len(x) - 1, interval=50)
# To save the animation using Pillow as a gif
writer = animation.PillowWriter(fps=15,
metadata=dict(artist='Me'),
bitrate=1800)
ani.save('scatter.gif', writer=writer)
# plot / show scatter.gif
plt.show()
Output of Py-Scater-animate project, Drawing Scater animated GIFs with matplotlib: