diff --git a/fc_plot.py b/fc_plot.py index cc2a854..4e87d4a 100644 --- a/fc_plot.py +++ b/fc_plot.py @@ -9,16 +9,29 @@ import random blue = '#0984e3' red = '#d63031' green = '#227D51' +kikyo = '#6A4C9C' +hanaba = '#F7C242' sim = [0.79844266, 0.8377947, 0.87015217, 0.91429971, 0.94337877, 0.89212607, 0.99805755, 0.98048562, 0.98530593, 0.99598291, 0.87856398, 0.99217795, 0.62392839, 0.99253731, 0.99703892] ana = [0.8, 0.8290884722222223, 0.8581769444444445, 0.8872654166666667, 0.9163538888888889, 0.9454423611111111, 0.9745308333333333, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5, 1.0, 1.0] +nowak_classic = [0.50427784, 0.26236224, 0.25333527, 0.25242894, 0.25232019, 0.25228393, 0.25228393, 0.25228393, 0.25228393, 0.25228393, 0.25228393, 0.25228393, 0.25228393, 0.25228393, 0.25228393] +nowak_survive = [0.50017833, 0.26068193, 0.88939394, 0.9595738, 0.99796403, 0.99828179, 0.99827646, 1, 1, 1, 1, 1, 1, None, None] +santos_survive = [0.50071587, 0.27929701, 0.9098483, 0.938, 0.99437628, 0.99861352, 0.99877322, 1, 1, 1, 1, 1, 1, None, None] +santos_classic = [0.49821874, 0.2757036, 0.26718917, 0.26270039, 0.25895974, 0.2562166, 0.25439971, 0.25290346, 0.25187032, 0.25097969, 0.25037406, 0.24983969, 0.24919843, 0.24884218, 0.24862843] + + def p1(x, coopr, crawx, crawy, postfix, show=True): - fig = plt.figure(figsize=(4.5, 1.8)) + fig = plt.figure(figsize=(5, 2)) ax = fig.gca() if postfix == 'SURVIVE': ax.plot(x, sim, marker='s', linestyle='dotted', markerfacecolor='none', color=red, linewidth=2, label="Simulation") ax.plot(x, ana, marker='^', linestyle='dotted', markerfacecolor='none', color=green, linewidth=2, label="Analytical") + ax.plot(x, santos_survive, marker='x', linestyle='dotted', markerfacecolor='none', color=kikyo, linewidth=2, label="Baseline#1") + ax.plot(x, nowak_survive, marker='*', linestyle='dotted', markerfacecolor='none', color=hanaba, linewidth=2, label="Baseline#2") + else: + ax.plot(x, santos_classic, marker='x', linestyle='dotted', markerfacecolor='none', color=kikyo, linewidth=2, label="Baseline#1") + ax.plot(x, nowak_classic, marker='*', linestyle='dotted', markerfacecolor='none', color=hanaba, linewidth=2, label="Baseline#2") ax.plot(x, coopr, marker='o', linestyle='dotted', markerfacecolor='none', color=blue, linewidth=2, label="Human") ax.scatter(crawx, crawy, s=15, c='dimgray', marker='x', linewidth=0.5, alpha=0.4) ax.set_ylim(-0.05, 1.05) @@ -32,13 +45,13 @@ def p1(x, coopr, crawx, crawy, postfix, show=True): ax.set_ylabel(r"f$_{\rm c}$", size=11, fontstyle='normal') ax.yaxis.grid(True, linestyle='--') # if postfix == 'SURVIVE': - # ax.legend(loc='best', fontsize=10, ncol=3) + # ax.legend(loc='upper center', fontsize=10, ncol=1) plt.tight_layout() if show: plt.show() else: - plt.savefig("graph/fc_plot_%s.eps" % postfix) + plt.savefig("graph/fc_plot_%s.pdf" % postfix) def plot(mode, show): diff --git a/ref.txt b/ref.txt new file mode 100644 index 0000000..c4a4482 --- /dev/null +++ b/ref.txt @@ -0,0 +1,2 @@ +Santos, F. C. & Pacheco, J. M. Scale-free networks provide a unifying framework for the emergence of cooperation.Phys. Rev. Lett.95, 098104 (2005). +Nowak, M. A. & May, R. M. Evolutionary games and spatial chaos.Nature359, 826–829 (1992). \ No newline at end of file