In [3]:
%pylab inline
%load_ext autoreload
%autoreload 2


Populating the interactive namespace from numpy and matplotlib

Communication Data

Stern Judging

Spread = 0.5


In [4]:
SJ_Z5_Sp05 = [0.3302394533130857, 0.352922886032816, 0.3270893366420979, 0.20302937145820216,0.21357124337938443,0.2881143746064669, 0.2817896959146635, 0.34465869106263197,]
SJ_Z12_Sp05 = [0.3464669216143808, 0.2267057987744402, 0.13040796135453578,0.27794522225102986,0.15816686626253648,0.29213035410776533,0.14295369350099385,0.13503760170129758,]
SJ_Z25_Sp05 = [0.005812724491572191, 0.005359760591705895, 0.021851853717434942, 0.007514468996066638, 0.0022738790657708574,0.008141689938443988, 0.002294667367906429, 0.0022699871850902597,0.003053526322417203, 0.003221957199682961, ]
SJ_Z50_Sp05 = [0.0011655371521270528,0.0011729842443277357,0.0011608708212653427,0.001209415995674042, 0.0012155793746620345,0.0011689756961162675,0.0011809491181416158,0.0012059478218357173,]
SJ_Z70_Sp05 = [0.0008766897895388794,0.0008465633381108946,0.0008423866253884571,0.0008512392986735654,0.0008724178380157314,0.0009024707817185645,0.0009057232623491845,0.0008360938728041976,]
SJ_Z90_Sp05 = [0.0007438052353199873,0.0006893584442646534,0.0007179418750152607,0.0006873499703107083,0.0007379454525451903,0.0007193400335201385,0.0007249827364976366,0.0006965170478171809,]
SJ_Z110_Sp05 = [0.000561949601830537, 0.0005812608865973234,0.0005628608421280623,0.0005748946013006892,0.0005813025918343196,0.000607223659263102, 0.000597968540201614, 0.0005562535082139268,]
SJ_Sp05_pops = [5, 12, 25, 50, 70, 90, 110]
SJ_Sp05 = [np.average(SJ_Z5_Sp05), np.average(SJ_Z12_Sp05), np.average(SJ_Z25_Sp05), np.average(SJ_Z50_Sp05), np.average(SJ_Z70_Sp05), np.average(SJ_Z90_Sp05), np.average(SJ_Z110_Sp05)]

Spread = 1.0


In [5]:
SJ_Z5_Sp1 = [0.551605283723273, 0.5175724724906389,0.5390293852940196,0.5162765232463824,0.5231397894066274,0.5548424808980774,0.5585572353971682,0.5470571002114822,]
SJ_Z12_Sp1 = [0.6006545587514521,0.6031333037858988,0.6012645018541221,0.572875282768537, 0.5809821575728058,0.5977000950054959,0.6072063191283424,0.5820188190769019,]
SJ_Z25_Sp1 = [0.11440860006370418,0.11409928962436759,0.16486568196801457,0.08756023081652457,0.08370402743724027,0.1282118549026289, 0.07901907717834947,0.14671788679916148,]
SJ_Z50_Sp1 = [0.0016197601463714547,0.001145913673434618, 0.0012271513122319425,0.001180339113623064, 0.0011948899621478679,0.0011727120200890377,0.0024816613456395973,0.0011337828428358728,]
SJ_Z70_Sp1 = [0.000842214855408604, 0.0008709422035023389,0.0009071871809783625,0.000850576406386079, 0.0008717415291511608,0.0008176708338429113,0.0008573797447630375,0.0008619793631124403,]
SJ_Z90_Sp1 = [0.0007255164624447607,0.0007468936212513326,0.0007104024958941168,0.000689761739433095, 0.0007193326031953232,0.0007064887723448157,0.0007314571786037006,0.0007132943783122673,]
SJ_Z110_Sp1 = [0.0005719257240901509,0.0005606057749188103,0.0005877640722040243,0.0005621820033071565,0.0005862629132422713,0.0005608736832394044,0.0005716807727807472,0.0005693664764826235,]
SJ_Sp1_pops = [5, 12, 25, 50, 70, 90, 110]
SJ_Sp1 = [np.average(SJ_Z5_Sp1), np.average(SJ_Z12_Sp1), np.average(SJ_Z25_Sp1), np.average(SJ_Z50_Sp1), np.average(SJ_Z70_Sp1), np.average(SJ_Z90_Sp1), np.average(SJ_Z110_Sp1),]

Spread = 1.75


In [6]:
SJ_Z5_Sp175 = [0.6284217348953144,0.6283080122518973,0.6435064389127367,0.5944240904595943,0.6368630069000255,0.6125606761506525,0.618803810384483, 0.6176305838169771,]
SJ_Z12_Sp175 = [0.7026216095039035,0.6950674823744203,0.7093454062689944,0.7268675101317248,0.7315937911395557,0.7176633158054906,0.731284733281934, 0.7105612929739246,]
SJ_Z25_Sp175 = [0.5638227497981466,0.6446904777072423,0.6269232601722976,0.5821249387032497,0.654946532937281, 0.6541845524781665,0.6534811517122349,0.6240828065393077,]
SJ_Z50_Sp175 = [0.31610185149519626,0.3244678923547582, 0.33309729146141825,0.001334274327957984,0.001260713042318832,0.12920256631530605,0.4183849384069512, 0.06758160504892628,]
SJ_Z70_Sp175 = [0.0008575690885692124,0.0008589234069912233,0.0009217944320373651,0.0009109071631823124,0.0008610347227061848,0.0009284375273528103,0.0008600579581012769,0.0008995317954736173,]
SJ_Z90_Sp175 = [0.0007379017009774939,0.0007140662274185738,0.0007206205396724798,0.0006983963512137395,0.0007542111756311048,0.000750846853495717, 0.0006809494315976037,0.0007208017306539474,]
SJ_Sp175_pops = [5, 12, 25, 50, 70, 90]
SJ_Sp175 = [np.average(SJ_Z5_Sp175), np.average(SJ_Z12_Sp175), np.average(SJ_Z25_Sp175), np.average(SJ_Z50_Sp175), np.average(SJ_Z70_Sp175), np.average(SJ_Z90_Sp175)]

Spread = 3.0


In [7]:
SJ_Z5_Sp3 = [0.6633910515204267,0.4996753583466054,0.5869487758805881,0.5719054409422571,0.6505216859883699,0.6585149449979629,0.703717915478351, 0.6608176228749213,]
SJ_Z12_Sp3 = [0.8053440636690248,0.8052631386038989,0.8050412296648847,0.8053193392450749,0.8052211488799996,0.8052219526649135,0.8053020739451255,]
SJ_Z25_Sp3 = [0.7583365713820103,0.7582661812309721,0.7582979103548915,0.7582694019955704,0.7583175993896251,0.7582168164208624,0.7582573263505655,0.7582046296639234,]
SJ_Z50_Sp3 = [0.6690980659115994, 0.6690179401328898, 0.6582777883539878, 0.6688790561411566, 0.6693560796746643, 0.6697599771109416,]
SJ_Z70_Sp3 = [0.6812520408919152,0.6869143150426584,0.6822029623546148,0.6754566136614282,0.6751826758889785,0.6817228111364695,0.6859617113943852,0.6791967013436683,0.6787649094074922,0.6806423526417656,]
SJ_Z90_Sp3 = [0.7115412550716328,0.7113719289557592,0.7089329139063582,0.7096382757842102,0.710220723399963,]
SJ_Z110_Sp3 = [0.7132582783904761,0.7133794115882468,]
SJ_Sp3_pops = [5, 12, 25, 50, 70, 90, 110]
SJ_Sp3 = [np.average(SJ_Z5_Sp3), np.average(SJ_Z12_Sp3), np.average(SJ_Z25_Sp3), np.average(SJ_Z50_Sp3), np.average(SJ_Z70_Sp3), np.average(SJ_Z90_Sp3), np.average(SJ_Z110_Sp3)]

Spread = 4.0


In [8]:
SJ_Z5_Sp4 = [0.6481046226097134,0.6625949540553854,0.698885162537639, 0.6447907029285294,0.6506003540753854,0.6891057374286571,0.6512008192622936,0.6899624443053493,]
SJ_Z12_Sp4 = [0.7970775727667304,0.7860600358190627,0.8044313197816371,0.8011906827792777,0.8076016343784812,0.7977128856907288,0.8024901056732309,0.7903543386323242,]
SJ_Z25_Sp4 = [0.8162421867476574,0.8162798251787103,0.8162625949109227,0.8162862402311196,0.8162526538019926,0.8162381199303678,0.8162433127152857,0.81625432053039,]
SJ_Z50_Sp4 = [0.7297770972999,0.7295176913959777,0.7296392551575984,0.7297528112152302,0.7298365643171969,0.7297052409348495,]
SJ_Z70_Sp4 = [0.6841190971925643,0.687145867458432, 0.6845825062681837,0.6862959795941044,]
SJ_Sp4_pops = [5, 12, 25, 50, 70]
SJ_Sp4 = [np.average(SJ_Z5_Sp4), np.average(SJ_Z12_Sp4), np.average(SJ_Z25_Sp4), np.average(SJ_Z50_Sp4), np.average(SJ_Z70_Sp4)]

Spread = 6.0


In [9]:
SJ_Z5_Sp6 = [0.6662928381216227,0.6690240889781073,0.6846589802184453,0.6651933155307983,0.7048313697458138,0.6817490249963889,0.6866606913358938,0.669986703654458, ]
SJ_Z12_Sp6 = [0.813867517281957, 0.8066106231206206,0.8047645546835359,0.80185820711373,0.8002873743925389,0.8085273579716962,0.8057750201029551,0.8122025644848068,]
SJ_Z25_Sp6 = [0.8175561539316271,0.8175269232193785,0.8175218934034594,0.817544538686618, 0.8175163376421349,0.8175213748657357,0.8175612356013185,0.8175356198377718,0.8175082141349195,0.8174972792391054,0.817498094059956, 0.8174793265135297,0.8174465707153387,0.8174812376387973,0.8174758064874554,0.8174844746998126,]
SJ_Z50_Sp6 = [0.8224437312493055,0.8224722100818549,0.8224467554353865,0.8224421145227601,0.8224413941257084,0.8224567854364977,0.8224536630986333,0.8224305363161598,0.8224457570056074,0.8224438510655635,0.8224705245964785,0.8224796935532855,0.7980534137289906,0.822470373484248, 0.822447928503174, 0.8224767176053156,]
SJ_Z70_Sp6 = [0.7798893468087631,0.779862852063304, 0.7798555020178374,0.7798918941442275,0.779878565986193, 0.7798530160981019,0.7798610190007454,0.779860178480536, 0.7798629980403483,0.7798528787288069,0.7798590822894984,0.7798807213386766,]
SJ_Z90_Sp6 = [0.7451757558236038,0.7450893220096401,0.7449556379317204,0.7450100952527277,0.7450043251487595,0.7449913341836368,0.7450039437877867,0.7449876250798017,0.7449558175739573,]
SJ_Z110_Sp6 = [0.71599785682298,0.7162438224678661,]
SJ_Sp6_pops = [5, 12, 25, 50, 70, 90, 110]
SJ_Sp6 = [np.average(SJ_Z5_Sp6), np.average(SJ_Z12_Sp6), np.average(SJ_Z25_Sp6), np.average(SJ_Z50_Sp6), np.average(SJ_Z70_Sp6), np.average(SJ_Z90_Sp6), np.average(SJ_Z110_Sp6)]

Plot results


In [12]:
line_Sp05, = plt.plot(SJ_Sp05_pops, SJ_Sp05, label='Spread = 0.5', marker='o', ms=7, linewidth=2)
line_Sp1, = plt.plot(SJ_Sp1_pops, SJ_Sp1, label='Spread = 1.0', marker='o', ms=7, linewidth=2)
line_Sp175, = plt.plot(SJ_Sp175_pops, SJ_Sp175, label='Spread = 1.75', marker='o', ms=7, linewidth=2)
line_Sp3, = plt.plot(SJ_Sp3_pops, SJ_Sp3, label='Spread = 3.0', marker='o', ms=7, linewidth=2)
#line_Sp4, = plt.plot(SJ_Sp4_pops, SJ_Sp4, label='Spread = 4.0', marker='o', ms=7, linewidth=2)
line_Sp6, = plt.plot(SJ_Sp6_pops, SJ_Sp6, label='Spread = 6.0', marker='o', ms=7, linewidth=2)
plt.ylim((-0.01, 1.05))
plt.xlim((-0.1, 125))
plt.legend(handles=[line_Sp05, line_Sp1, line_Sp175, line_Sp3, line_Sp6], loc='upper left', bbox_to_anchor=(1,1))
plt.grid(b=True, which='both')
plt.rcParams["figure.figsize"][0] = 9
plt.rcParams["figure.figsize"][1] = 5
plt.xticks([10*i for i in range(13)])
plt.yticks([0.1*i for i in range(11)])
plt.ylabel('Cooperation Index')
plt.xlabel('Population size')
plt.show()


Simple Standing

Spread = 0.5


In [23]:
SS_Z5_Sp05 = [0.18047890662617133,0.2052570465572799, 0.15046149857402125,0.12187581021519316,0.17933016037631022,0.1794862772695285, 0.17431756731730805,0.2436638394014593, ]
SS_Z12_Sp05 = [0.07348934734208262,0.08527675664942323,0.11289384174722521,0.068808104003852, 0.09836919114288184,0.07195083871419106,0.06565074040808096,0.07842786615553662,]
SS_Z25_Sp05 = [0.002499781473387903, 0.010092847883254935, 0.018619393310863364, 0.002465180191858958, 0.0025014185710581873,0.0022715878365865403,0.002316841364494981, 0.002545049816659876, ]

SS_Sp05_pops = [5, 12, 25]
SS_Sp05 = [np.average(SS_Z5_Sp05), np.average(SS_Z12_Sp05), np.average(SS_Z25_Sp05),]

Spread = 1.0


In [24]:
SS_Z5_Sp1 = [0.27951455375760653,0.2649012403749644, 0.28929488627735656,0.29722652676491396,0.2880029740850892, 0.28339727184174757,0.26449077589176256,0.2449517590805892, ]
SS_Z12_Sp1 = [0.1936470006473275, 0.1910185411952143, 0.17727950497038877,0.168288718070355, 0.17036986325257994,0.201219662439079, 0.1601835279431076, 0.20305042089147654,]
SS_Z25_Sp1 = [0.024305977429546037,0.032626570468779516,0.030562137637546807,0.03413430864558758, 0.029882435120130075,0.022624930462705417,0.021288425512687083,0.030149848703143346,]
SS_Z50_Sp1 = [0.0012147968443275677,0.001370143338642172, 0.0012397940664469055,0.0014255176117633987,0.001256848401792659, 0.013012828252898255, 0.008472567502500092, 0.003337143968295122, ]
SS_Sp1_pops = [5, 12, 25, 50]
SS_Sp1 = [np.average(SS_Z5_Sp1), np.average(SS_Z12_Sp1), np.average(SS_Z25_Sp1), np.average(SS_Z50_Sp1),]

Spread = 1.75


In [25]:
SS_Z5_Sp175 = [0.29066894692202566,0.3059829851221671, 0.2914568202104452, 0.314040126074541,0.3282232341601265, 0.3244064052089082, 0.32806317801177043,0.31466307282619566,]
SS_Z12_Sp175 = [0.24723730329659657,0.25558044762305704,0.3061669164875508, 0.3210920103459231, 0.29981885735379266,0.32423736343056414,0.2654355220605755, 0.2676167737092442, ]
SS_Z25_Sp175 = [0.06863591984888329, 0.05750502611207822, 0.06147003222341568, 0.015317041371902663,0.04377013222711952, 0.09548515130190006, 0.06923794955368717, 0.04607897329530723, ]
SS_Z50_Sp175 = [0.007907328049187007,0.007024699062928257,0.009781149301825994,0.02416148746249861, 0.014960998555502055,0.001211100411126338,0.021255361309678138,0.017912063409755916,]
SS_Sp175_pops = [5, 12, 25, 50]
SS_Sp175 = [np.average(SS_Z5_Sp175), np.average(SS_Z12_Sp175), np.average(SS_Z25_Sp175), np.average(SS_Z50_Sp175)]

Spread = 3.0


In [26]:
SS_Z5_Sp3 = [0.3462513426423201, 0.31057631764139415,0.3700375939849624, 0.4001859328123264, 0.2872408237342124, 0.3263719026630616, 0.2621874884254972, 0.2370348901811178, ]
SS_Z12_Sp3 = [0.41797616089690565,0.21021171437419492,0.4208762811688499, 0.5526583289093012, 0.3877220182537625, 0.3071240614364318, 0.5356150986559173, 0.5234255718318785, ]
SS_Z25_Sp3 = [0.1738763657913256, 0.29670295196118374,0.28258896255416865,0.23783843105300195,0.2502517945109078, 0.23321208192896034,]
SS_Z50_Sp3 = [0.0012431404866846921,0.00929292751583392, 0.03507416941368199, 0.02420134634616097, 0.006696736916182081,0.03458756065039446, 0.0013775713915330197,0.005151055594651654,]
SS_Sp3_pops = [5, 12, 25, 50]
SS_Sp3 = [np.average(SS_Z5_Sp3), np.average(SS_Z12_Sp3), np.average(SS_Z25_Sp3), np.average(SS_Z50_Sp3),]

Spread = 4.0


In [27]:
SS_Z5_Sp4 = [0.35424755276871395,0.3088443660902448, 0.3291041077929918, 0.34838823477123987,0.3366505987059211, 0.31351784636239394,0.35754167608028176,0.33120930077518806,]
SS_Z12_Sp4 = [0.4505490034479552,0.470501485396448, 0.4214931216566234,0.4646377998416455,0.45846102156345436, 0.4487076225282316,0.44540791251901757,]
SS_Z25_Sp4 = [0.5497455905774288,0.5820474980554835,0.2261424571280418,0.4495184710544835,0.5760896848031408,0.5064814326456536,0.4217558279936294,0.6161362568984037,]
SS_Z50_Sp4 = [0.0011610392977517685,0.08606748768472906, 0.0014502814919071076,0.0013305585392051557,0.0016516352457498426,0.001329986295788733, 0.01975715952442683, 0.06837490462609726, ]
SS_Z70_Sp4 = [0.024555266030261137, 0.0009938623955082237,0.017696878040078582, 0.0009120320782855904,0.032406854070936866, 0.07126762820391686, 0.0009358150830983158,0.006449476397840888, ]
SS_Sp4_pops = [5, 12, 25, 50, 70]
SS_Sp4 = [np.average(SS_Z5_Sp4), np.average(SS_Z12_Sp4), np.average(SS_Z25_Sp4), np.average(SS_Z50_Sp4), np.average(SS_Z70_Sp4)]

Spread = 6.0


In [28]:
SS_Z5_Sp6 = [0.3182877529176034, 0.32098155919095994,0.3506294467757288, 0.3237505879651406, 0.3405159833925311, 0.29039292738121253,0.36974509164848757,0.3417309323367864, ]
SS_Z12_Sp6 = [0.42794925732235223,0.4337210958291615, 0.43922099402837295,0.41622650942945877,0.4658157684534634, 0.4002205988108598, 0.48312278985806945,0.44641407944000616,]
SS_Z25_Sp6 = [0.5784782399348124,0.7152255416867291,0.5592633949405533,0.605368502537131, 0.5635824437942146,0.4606910033704952,0.7336353939034779,]
SS_Z50_Sp6 = [0.45830532241934885,0.8241083632727138,0.710520369272936, 0.5806467980295567,0.8243695136856921,0.5286272936034668,]
SS_Z70_Sp6 = [0.188848014779081, 0.26113775188952576,0.24557035370168662,]
SS_Z90_Sp6 = [0.0008765065144159432,0.000837585319803797, 0.0007564780634307901,0.0008459189617905373,0.0007650100438104932,0.0008146466558660837,]
SS_Sp6_pops = [5, 12, 25, 50, 70, 90]
SS_Sp6 = [np.average(SS_Z5_Sp6), np.average(SS_Z12_Sp6), np.average(SS_Z25_Sp6), np.average(SS_Z50_Sp6), np.average(SS_Z70_Sp6), np.average(SS_Z90_Sp6)]

In [29]:
line_SS_Sp05, = plt.plot(SS_Sp05_pops, SS_Sp05, label='Spread = 0.5', marker='o', ms=7, linewidth=2)
line_SS_Sp1, = plt.plot(SS_Sp1_pops, SS_Sp1, label='Spread = 1.0', marker='o', ms=7, linewidth=2)
line_SS_Sp175, = plt.plot(SS_Sp175_pops, SS_Sp175, label='Spread = 1.75', marker='o', ms=7, linewidth=2)
line_SS_Sp3, = plt.plot(SS_Sp3_pops, SS_Sp3, label='Spread = 3.0', marker='o', ms=7, linewidth=2)
line_SS_Sp4, = plt.plot(SS_Sp4_pops, SS_Sp4, label='Spread = 4.0', marker='o', ms=7, linewidth=2)
line_SS_Sp6, = plt.plot(SS_Sp6_pops, SS_Sp6, label='Spread = 6.0', marker='o', ms=7, linewidth=2)
plt.ylim((-0.01, 1.05))
plt.xlim((-0.1, 125))
plt.legend(handles=[line_SS_Sp05, line_SS_Sp1, line_SS_Sp175, line_SS_Sp3, line_SS_Sp4, line_SS_Sp6], loc='upper left', bbox_to_anchor=(1,1))
plt.grid(b=True, which='both')
plt.rcParams["figure.figsize"][0] = 9
plt.rcParams["figure.figsize"][1] = 5
plt.xticks([10*i for i in range(13)])
plt.yticks([0.1*i for i in range(11)])
plt.ylabel('Cooperation Index')
plt.xlabel('Population size')
plt.show()



In [ ]: