import matplotlib.pyplot as plt if __name__ == '__main__': wer = [] srr = [] with open('wer.txt', 'r') as w, open('srr.txt') as s: for line in w: wer.append(float(line.strip())) for line in s: srr.append(float(line.strip())) fig, ax = plt.subplots() ax.plot(list(range(1, len(wer) + 1)), wer, label='word error rate') ax.plot(list(range(1, len(srr) + 1)), srr, label='sentence recognition rate') ax.set_title("WER and SRR") ax.legend() plt.savefig('plot.png')