swdata/break_tie_bar.py
2018-08-19 23:26:08 +08:00

51 lines
1.1 KiB
Python

from scipy.stats import chi2_contingency as chi2
import numpy as np
from matplotlib import pyplot as plt
'''
survive
break_tie = [13.717872086072923, 86.26126126126125]
stay_connected = [86.28212791392707, 13.738738738738737]
classic
break_tie = [8.331150117893634, 42.07858048162231]
stay_connected = [91.66884988210636, 57.9214195183777]
'''
"""
NEW VERSION
"""
bt_s = [13.717872086072923, 86.26126126126125]
bt_c = [8.331150117893634, 42.07858048162231]
fig = plt.figure(figsize=(4, 4))
ax = fig.gca()
index = np.arange(2)
bar_width = 0.35
opacity = 1
error_config = {'ecolor': '0.3'}
rects1 = ax.bar(index, bt_s, bar_width,
alpha=opacity, color='#d63031',
label='Dissipative')
rects2 = ax.bar(index + bar_width, bt_c, bar_width,
alpha=opacity, color='#00b894',
label='Classic')
ax.set_ylabel('Frequency of Breaking Ties')
# ax.set_title('Behavior after Moves')
ax.set_xticks(index + bar_width / 2)
ax.set_xticklabels(('C', 'D'))
ax.set_xlabel('Previous Move')
ax.set_ylim(0,100)
ax.legend(loc='upper left')
fig.tight_layout()
# plt.show()
plt.savefig("graph/break_tie_bar.eps")