質問編集履歴
1
説明の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,52 @@
|
|
1
1
|

|
2
|
+
|
3
|
+
###Hを作成するプログラム
|
4
|
+
|
5
|
+
```
|
6
|
+
|
7
|
+
orient = np.random.randint(0, 360, 100000)
|
8
|
+
|
9
|
+
speed = np.random.randint(0, 900, 100000)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
x_edges = np.arange(0, 901, 100)
|
14
|
+
|
15
|
+
y_edges = np.linspace(0, 360, 17)
|
16
|
+
|
17
|
+
H = np.histogram2d(np.mod(orient + 11.25, 360), speed,
|
18
|
+
|
19
|
+
bins=(y_edges, x_edges))[0].astype(int)
|
20
|
+
|
21
|
+
print(H.shape) # (16, 9)
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
sns.set()
|
26
|
+
|
27
|
+
# 目盛りのラベルを設定する。
|
28
|
+
|
29
|
+
xlabels = ['{} ~ {}'.format(start, end)
|
30
|
+
|
31
|
+
for start, end in zip(x_edges, x_edges[1:])]
|
32
|
+
|
33
|
+
ylabels = ['N', 'NNW', 'NW', 'WNW',
|
34
|
+
|
35
|
+
'W', 'WSW', 'SW', 'SSW',
|
36
|
+
|
37
|
+
'S', 'SSE', 'SE', 'ESE',
|
38
|
+
|
39
|
+
'E', 'ENE', 'NE', 'NNE']
|
40
|
+
|
41
|
+
# ヒートマップを作成する。
|
42
|
+
|
43
|
+
sns.heatmap(H, annot=True, cmap='Reds', fmt='d',
|
44
|
+
|
45
|
+
xticklabels=xlabels, yticklabels=ylabels, cbar=False)
|
46
|
+
|
47
|
+
plt.show()
|
48
|
+
|
49
|
+
```
|
2
50
|
|
3
51
|
### 前提・実現したいこと
|
4
52
|
|