plt - ax.bar_label

화이팅·2023년 2월 14일
0

eda

목록 보기
18/29

fig,ax = plt.subplots(figsize=(15,6))
ax.bar_label(ax.containers[0],labels=[1,2,3,4], fmt='%.2f',edge_type='edge',padding=0,fontsize=14)

-> ax.containers[0] # bar 위에 라벨 표시
-> labels=[1,2,3,4] # bar위에 1,2,3,4 표시
-> fmt='%.2f' # 소수점 2자리수 까지 표현
-> edge_type='edge' # 라벨 위치 (edge/ center)
-> padding=0 # bar에서 라벨 떨어진 정도

파이차트

plt.pie(region_top10_df['Terrorpercent'],labels=region_top10_df['Region'],autopct='%.1f%%')

백분율표시 : autopct='%.1f%%'

profile
하하...하.

0개의 댓글