📌
### seaborn 모듈 : 시각화 모듈 + 데이터셋
# matplot 모듈의 확장형. 고급시각화
# 선형회귀 그래프 : 산점도 + 회귀도 표시
# 회귀선 : 모든점에서 가장 가까운 점들을 선으로 표시
import seaborn as sns
import matplotlib.pyplot as plt
titanic = sns.load_dataset("titanic")
titanic.info()
titanic[["age","fare"]].corr()
'''
regplot : 선형회귀 그래프 : 산점도 + 회귀도 표시
fit_reg=False : 회귀선 표시 안함.
'''
fig = plt.figure(figsize=(15,5))
ax1 = fig.add_subplot(1,2,1)
ax2 = fig.add_subplot(1,2,2)
sns.regplot(x='age', y='fare', data=titanic, ax=ax1)
sns.regplot(x='age', y='fare', data=titanic, ax=ax2, fit_reg=False)
plt.show()
'수업(국비지원) > Python' 카테고리의 다른 글
[Python] 지도를 이용한 시각화1 (0) | 2023.04.25 |
---|---|
[Python] 시각화 - seaborn 모듈을 이용한 그래프(distplot,kdeplot,histplot 등) (0) | 2023.04.25 |
[Python] matplot 시각화 모듈 - 박스그래프 (0) | 2023.04.25 |
[Python] matplot 시각화 모듈 - 파이그래프 (0) | 2023.04.25 |
[Python] matplot 시각화 모듈 - 연합 막대그래프 (0) | 2023.04.25 |