Skip to content
Snippets Groups Projects
Commit eb5a865f authored by Taddeüs Kroes's avatar Taddeüs Kroes
Browse files

ModSim ass3: Added plot script.

parent ad1a2ada
No related branches found
No related tags found
No related merge requests found
from sys import argv, exit
from pylab import figure, clf, plot, show, savefig
if len(argv) < 2:
print 'Usage: %s DATA_FILE [ TARGET_FILE ]' % argv[0]
exit()
f = open(argv[1], 'r')
lines = f.readlines()
f.close()
x = []
y = [[] for i in range(lines[0].count(','))]
for i in range(len(lines)):
if lines[i] == '':
pass
parts = lines[i].split(',', 1)
x.append(parts[0])
y_values = parts[1].split(',')
for j in range(len(y_values)):
y[j].append(y_values[j])
figure(1)
clf()
for i in range(len(y)):
plot(x, y[i], 'x')
if len(argv) == 3:
savefig(argv[2])
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