Commit bcc7933d authored by Fabien Grzeskowiak's avatar Fabien Grzeskowiak

working visualisation but slow

parent 53b14240
import pandas as pd import pandas as pd
import os import os
import matplotlib
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import matplotlib.animation as anim import matplotlib.animation as anim
import random as rd
matplotlib.use('Agg')
files = os.listdir("./output") files = os.listdir("./output")
df_ref = pd.read_csv("./output/"+files[0]) df_ref = pd.read_csv("./output/"+files[0])
fig = plt.figure() os.system("mkdir tmp")
ax1 = fig.add_subplot(1,1,1)
def animate(i):
for i in range(0,df_ref.shape[0]):
plt.clf()
for name in files:
df = pd.read_csv("./output/"+name)
ax1.clear()
ax1.plot(df.iloc[i][1],df.iloc[i][2],'bo')
ani = anim.FuncAnimation(fig, animate, interval = 1000) for i in range(0,df_ref.shape[0]):
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
axes = plt.gca()
axes.set_xlim([-20 ,20])
axes.set_ylim([-10,10])
for name in files:
df = pd.read_csv("./output/"+name)
ax1.scatter(df.iloc[i][1],df.iloc[i][2])
fig.savefig("tmp/test_{}.png".format(i))
plt.close(fig)
plt.show() os.system("ffmpeg -r 30 -i tmp/test_%01d.png -vcodec mpeg4 -y visual.mp4")
\ No newline at end of file os.system("rm -r tmp")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment