s452097-plots/plotCreator.py
alicja.m.musial d809e1c010 plot 1
2020-04-03 19:12:13 +02:00

35 lines
782 B
Python

import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def readFile(file):
with open(file, 'r') as inFile:
countL = 0
for line in open(thefilepath).xreadlines( ): countL += 1
y2 = np.genfromtxt(file)
return countL, y2
def createplot(sourceFile):
if sourceFile == 'wer.txt'
name = 'WER'
if sourceFile == 'srr.txt'
name = 'SRR'
readFile(sourceFile)
# Data for plotting
x = np.arange(1, countL)
y = y2
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set(xlabel='Build number', ylabel='Percent of '+name,
title=name+' metric for ASR')
ax.grid()
fig.savefig(name+'.png')
plt.show()
if __name__ == '__main__':
createplot('wer.txt')
createplot('srr.txt')