import matplotlib from matplotlib import pyplot as plt import csv import os probs = [] if os.path.exists('srr_results.txt') and os.path.exists('wer_results.txt'): with open('srr_results.txt','r') as srr_in: with open('wer_results.txt', 'r') as wrr_in: wrr_reader = csv.reader(wrr_in, lineterminator='\n') srr_reader = csv.reader(srr_in, lineterminator='\n') counter = 0 wrr_scores = [] srr_scores = [] for wrr, srr in zip (wrr_reader, srr_reader): wrr_scores.append(float(wrr[0])) srr_scores.append(float(srr[0])) counter+=1 for i in range(counter): probs.append(i) fig, ax = plt.subplots() plt.title("WER & SRR") plt.xlabel("Number of probe") plt.ylabel("Error value") plt.plot(probs, wrr_scores) plt.plot(probs, srr_scores) ax.legend(["WER", "SRR"]) plt.savefig('plot.png')