Skip to content

Commit b3cfad3

Browse files
committed
add Day20 homework
1 parent d32fa83 commit b3cfad3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

D20_seaborn/homework.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import numpy as np
2+
import seaborn as sns
3+
import matplotlib.pyplot as plt
4+
# 比較好的教學 https://zhuanlan.zhihu.com/p/27816821
5+
6+
# 作業目標(1):
7+
# 繪製模型殘差 圖型
8+
9+
10+
#設定圖形樣式 - whitegrid
11+
# sns.set_style('whitegrid')
12+
sns.set(style='whitegrid')
13+
14+
# 利用 NUMPY 去建立資料集
15+
rs = np.random.RandomState(7)
16+
x = rs.normal(2, 1, 75)
17+
y = 2 + 1.5 * x + rs.normal(0, 2, 75)
18+
# 畫圖
19+
sns.residplot(x=x, y=y, lowess=True, color="g")
20+
21+
# 作業目標(2):
22+
23+
# 使用 distplot()使用簡單的規則來正確猜測預設情況下正確的數位,但嘗試更多或更少的 bin 可能會顯示資料中的其他特徵:
24+
# 有無kde對圖形分布的影響
25+
# bin: 指的是特徵值,
26+
27+
# 使用sns.distplot()
28+
sns.displot()
29+
###
30+
plt.show()

0 commit comments

Comments
 (0)