1. 산점도(Scatter Plot)
- 두 변수의 상관 관계를 직교 좌표계의 평면에 점으로 표현하는 그래프
1) 그래프 그리기
① plt.scatter(x, y)
- array 또는 리스트가 들어감
t = np.array(range(0,10))
y = np.array([9,8,7,9,8,3,2,4,3,4])
plt.figure(figsize=(10,6))
plt.scatter(t,y)
plt.show()
② plt.scatter(x, y, s=area, c=colors)
- s, c 파라미터는 각각 마커의 크기와 색상을 지정
- 마커의 색상은 데이터의 길이와 같은 크기의 숫자 시퀀스 또는 rgb, 그리고 Hex code 색상을 입력해서 지정
③ plt.colorbar( )
-컬러 바 출력
t = np.array(range(0,10))
y = np.array([9,8,7,9,8,3,2,4,3,4])
colormap = t
plt.figure(figsize=(10,6))
plt.scatter(t,y, s=50, c=colormap, marker=">") # s는 마커 사이즈
plt.colorbar()
plt.show()
2. 참고할만한 사이트
Matplotlib Tutorial - 파이썬으로 데이터 시각화하기
## 도서 소개 - 이 책은 파이썬의 대표적인 데이터 시각화 라이브러리인 Matplotlib의 사용법을 소개합니다. - 30여 개 이상의 다양한 주제에 대해 1 ...
wikidocs.net
Plot types — Matplotlib 3.5.2 documentation
Overview of many common plotting commands in Matplotlib. Note that we have stripped all labels, but they are present by default. See the gallery for many more examples and the tutorials page for longer examples. Unstructured coordinates Sometimes we collec
matplotlib.org
'Python > Python 데이터분석' 카테고리의 다른 글
[Pandas] 그래프 그리기(plot) (0) | 2022.05.27 |
---|---|
[Matplotlib] 데이터 시각화 (0) | 2022.05.27 |
[Matplotlib] Matplotlib 이란? (0) | 2022.05.26 |
[Pandas] 데이터 병합 (0) | 2022.05.25 |
[Pandas] 함수 사용 (0) | 2022.05.25 |