自己查阅了资料和众多博客,记录一下,以备不时之需。
----------2021.07.30------------
补:matplotlib 3.4版本之后,已经提供了专门的在柱上方添加数值标注的api
官方给出的示例代码如下:
import matplotlib.pyplot as plt
import numpy as np
labels = ['G1', 'G2', 'G3', 'G4', 'G5']
men_means = [20, 34, 30, 35, 27]
women_means = [25, 32, 34, 20, 25]
x = np.arange(len(labels)) # the label locations
width = 0.35 # the width of the bars
fig, ax = plt.subplots()
rects1


9036

被折叠的 条评论
为什么被折叠?



