-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
57 lines (39 loc) · 1.28 KB
/
test.py
File metadata and controls
57 lines (39 loc) · 1.28 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
import numpy as np
import matplotlib.pyplot as plt
def testSubPlots():
labels = ['Контрольная\nгруппа № %i' % i for i in range(1, 6)]
value = (12, 24, 18, 11, 6)
position = np.arange(5)
fig, ax = plt.subplots()
ax.barh(position, value)
# Устанавливаем позиции тиков:
ax.set_yticks(position)
# Устанавливаем подписи тиков
ax.set_yticklabels(labels,
fontsize=15)
fig.set_figwidth(10)
fig.set_figheight(6)
plt.show()
if __name__ == '__main__':
from random import gauss
rands = [gauss(0, 1) for x in range(1000)]
rands = np.random.normal(0, 1, 1000)
rands = [np.random.normal(0, 1) for x in range(1000)]
values = {}
for x in rands:
if x not in values:
values[x] = 0
values[x] += 1
fig, ax = plt.subplots()
ax.hist(rands, 30)
fig.show()
import matplotlib.pyplot as plt
mu, sigma = 0, 1 # mean and standard deviation
s = np.random.normal(mu, sigma, 1000)
count, bins, ignored = plt.hist(s, 30)
# plt.plot(bins, 1 / (sigma * np.sqrt(2 * np.pi)) *
#
# np.exp(- (bins - mu) ** 2 / (2 * sigma ** 2)),
#
# linewidth=2, color='r')
plt.show()