s452097-plots/plotCreator.py
alicja.m.musial 71b227bee9 plot 17
2020-04-03 20:53:04 +02:00

54 lines
1.1 KiB
Python

import matplotlib.pyplot as plt
import numpy as np
def readFile(file, y):
with open(file, 'r') as inFile:
data = inFile.read()
countL = 0
for line in inFile:
countL += 1
y2 = y.append(float(line.strip()))
return countL, y2;
def createplotWER():
x = []
y = []
countL, y2 = readFile('werForPlot.txt', y)
# Data for plotting
x = np.arange(1, countL, 1)
y = y2
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set(xlabel='Build number', ylabel='Percent [%]',
title='Metric for ASR')
ax.grid()
name = sourceFile.rstrip('.')
fig.savefig('wer.png')
plt.show()
def createplotSRR():
x = []
y = []
countL, y2 = readFile('srrForPlot.txt', y)
# 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 [%]',
title='Metric for ASR')
ax.grid()
name = sourceFile.rstrip('.')
fig.savefig('srr.png')
plt.show()
if __name__ == '__main__':
createplotWER()
createplotSRR()