Skip to content

Commit 24e03d2

Browse files
committed
Font sizes fix on schelling
1 parent 3f07c4c commit 24e03d2

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

schelling-segregation/experiment.py

+18-6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
import numpy as np
2828
import seaborn as sns
2929
from matplotlib import pyplot as plt
30+
31+
SMALL_SIZE = 12
32+
MEDIUM_SIZE = 16
33+
BIGGER_SIZE = 20
34+
35+
plt.rc('font', size=SMALL_SIZE) # controls default text sizes
36+
plt.rc('axes', titlesize=SMALL_SIZE) # fontsize of the axes title
37+
plt.rc('axes', labelsize=MEDIUM_SIZE) # fontsize of the x and y labels
38+
plt.rc('xtick', labelsize=SMALL_SIZE) # fontsize of the tick labels
39+
plt.rc('ytick', labelsize=SMALL_SIZE) # fontsize of the tick labels
40+
plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize
41+
plt.rc('figure', titlesize=BIGGER_SIZE)
3042
# Import the model to be simulated
3143
from model import Environment, Parameters
3244

@@ -112,18 +124,18 @@ def run_multiple_retries():
112124

113125
fig, ax = plt.subplots()
114126

115-
model.Parameters.POPULATION_SIZE = 200
127+
model.Parameters.POPULATION_SIZE = 266
116128
for ht in [0.20,0.35,0.50,0.65,0.80,0.95]:
117129
model.Parameters.HAPPINESS_THRESHOLD = ht
118130
run_multiple_retries()
119131

120-
plt.legend(loc="upper right", fontsize=15, ncol=2)
132+
plt.legend(loc="upper right", ncol=2)
121133
plt.xlim((0,40))
122134
plt.ylim((0,100))
123-
plt.xticks(fontsize=25)
124-
plt.yticks(fontsize=25)
125-
plt.xlabel("Time", fontsize=35)
126-
plt.ylabel("Unhappy agents (%)", fontsize=35)
135+
# plt.xticks(fontsize=25)
136+
# plt.yticks(fontsize=25)
137+
plt.xlabel("Time")
138+
plt.ylabel("Unhappy agents (%)")
127139
plt.tight_layout()
128140
plt.savefig("results/scheling-%d-%d-%d-%.2f-%.2f.png" % (model.Parameters.POPULATION_SIZE, model.Parameters.GRID_SIZE[0], model.Parameters.GRID_SIZE[1], model.Parameters.RED_PROBABILITY, model.Parameters.HAPPINESS_THRESHOLD))
129141
plt.show()

0 commit comments

Comments
 (0)