forked from EnboLyu/Spatial-Computing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresult_bar_chart.py
More file actions
95 lines (66 loc) · 2.53 KB
/
Copy pathresult_bar_chart.py
File metadata and controls
95 lines (66 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# -*- coding: utf-8 -*-
"""result_bar_chart.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1UJh1eBSIfCyydcDHZjXgXoQ16D5pd8Lk
"""
import numpy as np
import operator
N = 4
n = [1,2,3,4]
n_1 = [0,1,2,3]
four = [4,4,4,4]
three = [3,3,3,3]
two = [2,2,2,2]
one = [1,1,1,1]
cell_type_1 = list(map(operator.add, n, four))
output = [1,1,2,3]
colonies = list(map(operator.add, n, output))
cell_types_2 = list(map(operator.mul, n, three))
branches = list(map(operator.pow, two, n_1))
cell_types_3 = [2*x + y for x, y in zip(n, one)]
ind = np.arange(N)
width = 0.1
plt.bar(ind, cell_type_1, width, label='Cell types = $n+4$',color = 'tab:blue')
plt.bar(ind + width, colonies, width,label='Colonies',color = 'skyblue')
plt.bar(ind + 3*width, cell_types_2, width,label='Cell types=$3n$',color = 'tab:green')
plt.bar(ind + 4*width, branches, width,label='Branches=$2^{n-1}$',color = 'mediumaquamarine')
plt.bar(ind + 6*width, cell_types_3, width,label='Cell types=$2n+1$',color = 'tab:red')
plt.bar(ind + 7*width, branches, width,label='Branches=$2^{n-1}$',color = 'lightcoral')
plt.ylabel('Count')
plt.xlabel('Number of inputs(n)')
plt.xticks(ind + width*3 , ('1', '2', '3', '4'))
plt.legend(loc='best')
plt.savefig('fig 7.pdf')
plt.show()
import numpy as np
import operator
N = 10
n = [1,2,3,4,5,6,7,8,9,10]
n_minus_1 = [2,3,4,5,6,7,8,9,10]
n_1 = [0,1,2,3,4,5,6,7,8,9]
four = [4]*10
three = [3]*10
two = [2]*10
one = [1]*10
minus_one = [-1]*10
cell_type_1 = list(map(operator.add, n, four))
output = [1]+ list(map(operator.add, n_minus_1, minus_one))
colonies = list(map(operator.add, n, output))
cell_types_2 = list(map(operator.mul, n, three))
branches = list(map(operator.pow, two, n_1))
cell_types_3 = [2*x + y for x, y in zip(n, one)]
ind = np.arange(N)
width = 0.1
plt.bar(ind, cell_type_1, width, label='Cell types = $n+4$',color = 'tab:blue')
plt.bar(ind + width, colonies, width,label='Colonies = $n+n-1$',color = 'skyblue')
plt.bar(ind + 3*width, cell_types_2, width,label='Cell types=$3n$',color = 'tab:green')
plt.bar(ind + 4*width, branches, width,label='Branches=$2^{n-1}$',color = 'mediumaquamarine')
plt.bar(ind + 6*width, cell_types_3, width,label='Cell types=$2n+1$',color = 'tab:red')
plt.bar(ind + 7*width, branches, width,label='Branches=$2^{n-1}$',color = 'lightcoral')
plt.ylabel('Count')
plt.xlabel('Number of inputs(n)')
plt.xticks(ind + width*3 , ('1', '2', '3', '4','5','6','7','8','9','10'))
plt.legend(loc='best')
plt.savefig('line_plot.pdf')
plt.show()