Crawling/데이터 시각화

데이터시각화_10가지_Scatter chart

km1n 2022. 1. 6. 17:03

파이썬 시각화 차트 종류

1. Column/Bar chart

FEMALE_runner.head()


2. Dual Axis, 파레토 chart
3. Pie chart
4. Line chart
5. Scatter chart
6. Bubble chart
7. Heat map
8. Histogram
9. Box plot
10. Geo chart

 

 

머신러닝 : 독립변수(여러 개)들로 종속변수를 예측.
변수들간의 상관관계

 

Scatter 사용처 : 머신러닝에서 변수 간 상관관계(correlation) 파악 : 선형회귀
 3  5  7 10
70 80 90 100

 

marathon_2015_2017 = pd.read_csv('./data_boston/marathon_2015_2017.csv')
marathon_2015_2017.info()
MALE_runner = marathon_2015_2017[marathon_2015_2017['M/F']=='M']
FEMALE_runner = marathon_2015_2017[marathon_2015_2017['M/F']=='F']
FEMALE_runner.head()
x_male = MALE_runner.Age
y_male = MALE_runner['Official Time']

x_female = FEMALE_runner.Age
y_female = FEMALE_runner['Official Time']

 

Scatter chart 그리기

# figure size 지정
plt.figure(figsize=(20, 20))

plt.plot(x_male, y_male, '.', color='b', alpha=0.5)
plt.plot(x_female, y_female, '.', color='r', alpha=0.5)

# label과 title 정하기
plt.xlabel('Age', fontsize=30)
plt.ylabel('Official Time(second)', fontsize=30)
plt.title('Distribution by Running time and Age', fontsize=30)

plt.legend(['Male', 'Female'], loc='upper left')

plt.show()