Line | |
---|
1 | import matplotlib.pyplot as plt
|
---|
2 | import json
|
---|
3 |
|
---|
4 | dictionary = json.load(open('././results/results_summaries.json', 'r'))
|
---|
5 |
|
---|
6 | i = 0
|
---|
7 |
|
---|
8 | for result in dictionary:
|
---|
9 | print(result.items())
|
---|
10 | agreement = (result["result"] == "agreement")
|
---|
11 | print(agreement)
|
---|
12 | adding = {'nash_product','social_welfare'}
|
---|
13 |
|
---|
14 | xAxis = []
|
---|
15 | yAxis = []
|
---|
16 | for (key, value) in result.items():
|
---|
17 | if adding.__contains__(key):
|
---|
18 | xAxis.append(key)
|
---|
19 | yAxis.append(value)
|
---|
20 | elif 'utility' in key:
|
---|
21 | key_new ="agent_"+ key[8:]
|
---|
22 |
|
---|
23 | xAxis.append(result[key_new][:len(result[key_new]) - 5] + " utility")
|
---|
24 | yAxis.append(value)
|
---|
25 |
|
---|
26 | if agreement:
|
---|
27 | ## LINE GRAPH ##
|
---|
28 | color = 'blue'
|
---|
29 |
|
---|
30 | ## BAR GRAPH ##
|
---|
31 | fig = plt.figure()
|
---|
32 | plt.bar(xAxis, yAxis, alpha=1, color=color, zorder=5)
|
---|
33 | plt.grid(figure=fig, zorder=0)
|
---|
34 | plt.xlabel('variable')
|
---|
35 | plt.ylabel('value')
|
---|
36 | plt.show()
|
---|
37 |
|
---|
38 | fig.savefig("././results/plots/fig" + str(i) + ".png")
|
---|
39 | i = i+1
|
---|
Note:
See
TracBrowser
for help on using the repository browser.