From 2c6284e1bf81c4c0ed2d2e1db44ed0485be87e95 Mon Sep 17 00:00:00 2001 From: wjsjwr Date: Tue, 10 Nov 2020 22:32:09 +0800 Subject: [PATCH] update graph and table --- calc_survivals.py | 19 ++++++++++++++++++- fc_plot.py | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/calc_survivals.py b/calc_survivals.py index 871d1a4..a72e254 100644 --- a/calc_survivals.py +++ b/calc_survivals.py @@ -31,4 +31,21 @@ for f in Path('wos-data-compete').iterdir(): result[name] = survivals -print(json.dumps(result)) \ No newline at end of file +# print(json.dumps(result)) + +average = [0]*20 +for k, v in result.items(): + for r, l in v.items(): + average[int(r)] += len(l) + +for i in range(20): + average[i] /= len(result) + +idx=[] +s=[] +for i in range(1,16): + idx.append(str(i)) + s.append("%.1f"%average[i]) + +print(" & ".join(idx)) +print(" & ".join(s)) diff --git a/fc_plot.py b/fc_plot.py index 4e87d4a..95f6c03 100644 --- a/fc_plot.py +++ b/fc_plot.py @@ -44,8 +44,8 @@ def p1(x, coopr, crawx, crawy, postfix, show=True): ax.set_xlabel("Rounds", size=11) ax.set_ylabel(r"f$_{\rm c}$", size=11, fontstyle='normal') ax.yaxis.grid(True, linestyle='--') - # if postfix == 'SURVIVE': - # ax.legend(loc='upper center', fontsize=10, ncol=1) + if postfix == 'SURVIVE': + ax.legend(loc='upper center', fontsize=10, ncol=3) plt.tight_layout() if show: