본문 바로가기

Data Science/Data Visualization

[05. Etcetera Chart] 002. Scatter Plot

728x90

산점도는 변수 간의 관계를 점으로 표현한 것이다. 변수 간의 상호 관계가 존재하지 않으면 랜덤하게 분포하는 모습을 보인다.

 

import matplotlib.pyplot as plt
import seaborn as sns 

if __name__ == '__main__':
    df = sns.load_dataset('iris')
print(df.head())
sns.regplot(x=df['sepal_length'], y=df['sepal_width'], fit_reg=False)
    plt.show()


결과 값
    sepal_length  sepal_width  petal_length  petal_width species
0           5.1          3.5           1.4          0.2  setosa
1           4.9          3.0           1.4          0.2  setosa
2           4.7          3.2           1.3          0.2  setosa
3           4.6          3.1           1.5          0.2  setosa
4           5.0          3.6           1.4          0.2  setosa

 

728x90