回答編集履歴

1

d

2019/01/30 16:50

投稿

tiitoi
tiitoi

スコア21956

test CHANGED
@@ -18,7 +18,9 @@
18
18
 
19
19
  from scipy import stats
20
20
 
21
- # %matplotlib nbagg # jupyter notebook の場合、コメントアウト
21
+ # jupyter notebook の場合、コメントアウト
22
+
23
+ # %matplotlib nbagg
22
24
 
23
25
 
24
26
 
@@ -28,7 +30,7 @@
28
30
 
29
31
 
30
32
 
31
- locs = np.linspace(15, 0, 16)
33
+ locs = np.linspace(15, 0, 16) # 平均
32
34
 
33
35
  fig, ax = plt.subplots(figsize=(4, 4))
34
36
 
@@ -36,19 +38,19 @@
36
38
 
37
39
  def plot(i, locs):
38
40
 
39
- plt.cla()
40
-
41
41
  data = stats.norm.rvs(loc=locs[i], scale=2, size=7321)
42
42
 
43
43
 
44
44
 
45
- ax.clear()
45
+ ax.clear() # 図をクリア
46
+
47
+ # kde=False 密度関数描画しない、bins=50 ビンの数、norm_hist ヒストグラム正規化
46
48
 
47
49
  sns.distplot(data, bins=50, ax=ax, kde=False, norm_hist=True)
48
50
 
49
51
  # ax.hist(data) setborn 使わない場合はこっち
50
52
 
51
- ax.set_ylim(0, 0.3)
53
+ ax.set_ylim(0, 0.3) # y 軸範囲固定
52
54
 
53
55
 
54
56