plt.bar <-- 막대그래프
plt.ylim(y의 첫 숫자, y의 끝 숫자)
plt.title('~~',loc='~') <- ~~의 내용을 제목으로 설정 and
loc는 제목의 위치로 left,right,center
plt.xlabel('~'),plt.ylabel('~') <- x위치의 ~이름 , y위치의 ~이름 설정
rotation=숫자 <-- 숫자 만큼 회전
예시)
x=y.index
plt.bar(x,y,color='gray')
plt.ylim(450,650)
plt.title('요일별 교통사고 건수',loc='center')
plt.xlabel('요일')
plt.ylabel('사고건수',rotation=90)
for i in range(7):
plt.text(x[i],y[i],f'{y[i]}')
plt.show()
'Python' 카테고리의 다른 글
encoding <- 암호화 (1) | 2023.10.19 |
---|---|
산점도(scatter)그래프, 막대(bar) 및 수평 막대(barch)그래프 (0) | 2023.10.18 |
꺽은선 그래프 (0) | 2023.10.18 |
matplotlib (0) | 2023.10.18 |
카테고리 <- pd.cut (0) | 2023.10.18 |