如题、学习、保存
1 源码
# -*- coding: utf-8 -*-
'''
time:2019-8-21
author:Bing
'''
import matplotlib.pyplot as plt
#num_list = [1.5,0.6,7.8,6]
fig, ax = plt.subplots()
num_list = [7870,81937,17529598,6225227]
name_list = ['Eviction','Failed','Finished','Killed']
b = ax.bar(name_list, num_list)
plt.bar(range(len(num_list)), num_list,color='rbg',tick_label=name_list)
for a, b in zip(name_list, num_list):
ax.text(a, b+1, b, ha='center', va='bottom')
plt.title('Numbers of Four eventtypes')
plt.xlabel('Eventtype')
plt.ylabel('Number')
plt.show()