一、柱状图
matplotlib.pyplot.bar(x, height, width=0.8, bottom=None, *, align=‘center’, data=None, **kwargs)
1、主要参数:
x: 柱形x的坐标,一般可采用arange函数产生一个序列
height: 柱形的高度,即需要展示的数据
width: 柱形的宽度,默认值0.8
bottom: 柱形基座的y坐标,默认值0
align: 横坐标数字在柱形的位置,可选{‘center’, ‘edge’},默认: ‘center’,若想标在右边,则可以通过width=负值,align=‘edge’实现
2、其他参数:
alpha: 透明度,数值为 float 类型或者默认
color/facecolor: 柱形颜色
label: 每个柱形图代表的含义,要加语句:plt.legend(loc=“upper left”) 才能显示label

最低0.47元/天 解锁文章

1万+

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



