군침이 싹 도는 코딩
Python 여러개 그래프 한번에 보기 본문
# 하나에 여러개의 plot을 그린다.
plt.figure(figsize=(12,5)) # 그래프의 가로 세로 조절
plt.subplot(1,2,1) # 1행 2열 첫번째 차트
plt.title('speed hist. bins 10')
plt.xlabel('speed')
plt.ylabel('# of Characters')
plt.hist(data=df,x='speed',rwidth=0.8)
plt.subplot(1,2,2) # 1행 2열 두번째 차트
plt.title('speed hist. bins 30')
plt.xlabel('speed')
plt.ylabel('# of Characters')
plt.hist(data=df,x='speed',rwidth=0.8,bins=30)
plt.show()
# plt.subplot(x,y,z) 는 여러개의 차트를 만들어준다 x에는 행 y 열 z 는 몇번째
figure(figsize=x,y)는 x는 가로 y는 세로값을 넣어 그래프의 크기를 조절해준다
plt.title은 그래프의 제목을 붙일수있다
plt.xlabel 은 x축에 제목
plt.ylabel 은 y축에 제목
'Python > Matplotlib' 카테고리의 다른 글
Python heat Maps / 그래프의 한글처리 (0) | 2022.11.28 |
---|---|
Python 스케터/리그플롯/페어플롯 (0) | 2022.11.28 |
Python 히스토그램 (0) | 2022.11.28 |
Python Matplotlib 바차트/파이차트 (0) | 2022.11.28 |