Each CSV file has different n and m values, I want to compare the plots to each other but with this code I am just seeing lines without knowing which plot belong to which CSV. I want to visualize the legend in (n= "value", m = "value") in the code below:
plt.rcParams["figure.figsize"] = [10, 10]
plt.rcParams["figure.autolayout"] = True
columns = ["filename", "filtered","filtered_max","threshold2", "pfa", "m", "n", ]
# setup env
f= Path.cwd().joinpath("/home / ....")
if not f.is_dir():
f.mkdir()
fh = open('tst_zero.csv', 'w')
cvs_writer = csv.writer(fh)
cvs_writer.writerow(["filename", "count"])
fh.close()
all_files = glob.glob(f'{f}/results_*.csv')
li = []
color = cm.rainbow(np.linspace(0, 1))
for filename in all_files:
frame = pd.read_csv(filename, usecols=columns)
li.append(frame)
count = (frame['filtered_max'] == 0).groupby(frame['pfa']).sum()
out2= [filename,count]
fh = open("tst_zero.csv", 'a') # `a` for `append mode`
cvs_writer = csv.writer(fh)
cvs_writer.writerow(out2)
fh.close()
print(filename , 'Count of zeros in filtered_max : ', count)
plt.title("Pfa vs Threshold ")
plt.xlabel('Threshold')
plt.ticklabel_format(axis='y',style='sci',scilimits=(2,10))
plt.ylabel('Pfa')
plt.plot(frame.threshold2, frame.pfa)
plt.grid()
plt.show()