Python

Python파이썬 데이터 시각화 matplotlib subplot()

왕현성 2022. 11. 28. 12:31
728x90
# 하나에 여러개의 plot을 그린다.

plt.figure(figsize=(12,5)) # 가로,세로 사이즈 변경

plt.subplot(1,2,1) # 1행 2열중에 첫번째 plot

plt.title('speed hist.bins 10') # 제목 설정
plt.xlabel('Speed') # x축 설정
plt.ylabel('# of Characters') # y축 설정

plt.hist(data=df,x='speed',rwidth=0.8)


plt.subplot(1,2,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()