From a7a6906a6d493e5f404924accd504e60c8a763a2 Mon Sep 17 00:00:00 2001 From: Mhrooz Date: Thu, 29 Aug 2024 09:36:33 +0200 Subject: [PATCH] add format plot codes --- analyze.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/analyze.py b/analyze.py index 9e7f121..302dbc5 100644 --- a/analyze.py +++ b/analyze.py @@ -5,11 +5,19 @@ import pandas as pd import argparse def plot(l,filename): + lenth = len(l) threshold = [0, 10000, 20000, 30000, 40000, 50000, 60000, 70000] labels = ['0-10k', '10k-20k,', '20k-30k', '30k-40k', '40k-50k', '50k-60k', '60k-70k'] l = [i/15625 for i in l] l = l[:7] + datasets = filename.split('_')[-1].split('.')[0] + plt.figure(figsize=(8, 6)) + plt.subplots_adjust(top=0.85) + plt.ylim(0,0.3) + plt.title('Distribution of Swap Scores in ' + datasets) plt.bar(labels, l) + for i, v in enumerate(l): + plt.text(i, v + 0.01, str(round(v, 2)), ha='center', va='bottom') plt.savefig(filename) def analyse(filename):