Python实现可视化(六)--柱状图
python实现柱状图可视化
已知:数据基础格式为dataframe
# 加载基础包
import matplotlib.pyplot as plt
import pandas as pd
# x轴刻度
x = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18',
'19', '20', '21', '22', '23']
height1 = list(df_final[df_final['index'] == '0']['占比'])
plt.bar(x, +np.array(height1), color='black', width=0.5)
height2 = list(df_final[df_final['index'] == '0