# unstack()하여 인덱스를 컬럼으로 변경하기
grouped.unstack()
grouped.unstack().plot(kind='bar')
grouped.unstack().plot(kind='bar', stacked=True)
ax = grouped.unstack().plot(kind='bar', stacked=True)
containers = ax.containers[-1]
ax.bar_label(containers, labels=[f'{x:,.0f}' for x in containers.datavalues], label_type='center')
containers0 = ax.containers[-2]
ax.bar_label(containers0, labels=[f'{x:,.0f}' for x in containers0.datavalues], label_type='center')
plt.title('Payment by Type')
plt.show()
'visualization' 카테고리의 다른 글
Radar Chart를 이용한 군집 결과 시각화 (0) | 2023.02.06 |
---|---|
정규화(Normalization)로 RFM Score 구하기 (0) | 2023.02.06 |
barplot에 annotation 추가하기 (0) | 2023.02.02 |
Matplotlib Subplot (0) | 2022.11.18 |
데이터의 빈도수 시각화 (0) | 2022.11.18 |