Mentions légales du service

Skip to content
Snippets Groups Projects
Commit fd0a2873 authored by Fabien Grzeskowiak's avatar Fabien Grzeskowiak
Browse files

#19 add simple viz tool

parent f0bc0d69
No related branches found
No related tags found
No related merge requests found
def create(filename):
i = 0
for f in filename :
target = open(f, 'w')
target.truncate()
for l in range(1000) :
target.write("{}".format(0.01*l))
target.write(" ")
target.write("{}".format(0.01*l+i))
target.write(" ")
target.write("{}".format(0.01*l*i))
target.write("\n")
target.close()
i += 1
File added
import create_fake_files
print("How many files?")
nb = input("> ")
filename = ["f{}.txt".format(i) for i in range(nb)]
create_fake_files.create(filename)
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.grid(True, linestyle = '-', color = '0.75')
ax.set_xlim([-5, 20])
ax.set_ylim([-5, 20])
traj = open('f3.txt','r').read()
lines = traj.split('\n')
def _update_plot(i):
#if i > len(lines) :
# return
t, x, y = lines[i].split(" ")
#ax.clear()
ax.plot(x,y,'ro')
anim = animation.FuncAnimation(fig, _update_plot, interval = 10)
plt.show()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment