Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- del
- append()
- numpy
- pandas
- Python
- matplotlib
- insert()
- 분류 결과표
- len()
- analizer
- 최댓값
- function
- string
- 덴드로그램
- elbow method
- 반복문
- Machine Learning
- sklearn
- wcss
- 최솟값
- hierarchical_clustering
- list
- dendrogram
- count()
- data
- nan
- DataFrame
- DataAccess
- Dictionary
- IN
Archives
- Today
- Total
개발공부
[Python] Matplotlib 여러개의 차트를 그릴 수 있는 Subplot 본문
Matpotlib의 subplot을 사용하면 각각 다른 차트들을 행과 열에 맞춰서 배치할 수 있다.
아래는 포켓몬 세대와 종에 대한 정보가 담겨있는 데이터 프레임이다.

speed 값의 구간에 따른 데이터의 갯수에 대한 히스토그램을
bins(구간)가 10과 20에 대해 그리면 아래와 같이 그릴 수 있다.
import matplotlib as plt
# 하나에 여러개의 plot을 그린다.
plt.figure(figsize= (12, 5))
plt.subplot(1, 2, 1) # subplot(행, 열, 번호)
plt.hist(data = df, x = 'speed', rwidth = 0.8, bins = 10)
plt.subplot(1, 2, 2)
plt.hist(data = df, x = 'speed', rwidth = 0.8, bins = 20)
plt.show()

'Python > Matplotlib' 카테고리의 다른 글
| [Python] Matplotlib 여러 개의 변수 시각화 방법 (Scatter, seaborn.Regplot, Heat Map), 상관계수 (dataframe.corr()) (0) | 2022.05.04 |
|---|---|
| [Python] Matplotlib Histogram(히스토그램) (0) | 2022.05.03 |
| [Python] Matplotlib Plot(플롯), Bar(바), Pie(파이) Chart (0) | 2022.05.03 |