python绘制条形图(二)

接着条形图(一)继续更新

matplotlib.pyplot.bar(x, height, width=0.8, bottom=None, *, align='center', data=None, **kwargs)

** 参数详细介绍*
Other Parameters:

color条形的颜色可以设置单个颜色,或者颜色列表
edgecolor条形边框的颜色可以是单个颜色,或者颜色列表
linewidth条形边框的宽度float or array-like
tick_label条形图的标签,也是x轴上的刻度名称,默认是没有的,使用的是默认的数字,一般情况下都使用不到str or list of str
xerr, yerr为x,或y的误差线float or array-like of shape(N), or shape(2, N)
ecolor 误差线颜色color or list of color,default: ‘black’
capsize错误条的长度,以点为单位float,default: 0.0

color

import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
a = [1, 2, 3, 4, 5]
b = [6, 8, 10, 12, 14]
plt.bar(a, b, 0.5,color='cyan')

在这里插入图片描述
edgecolor

plt.bar(a, b, 0.5,color='cyan', edgecolor='red',align='center')

在这里插入图片描述
linewidth

plt.bar(a, b, 0.5,color='cyan', edgecolor='red',linewidth=5,align='center')

在这里插入图片描述
tick_label

plt.bar(a, b, width=0.5, color='cyan', edgecolor='red', linewidth=5, tick_label=['a','b','c','d','e'],align='center')

在这里插入图片描述
xerr,yerr

# yerr
plt.bar(a, b, width=0.5, color='cyan', yerr=[1,1.1,1.2,1.3,1.4],align='center')

在这里插入图片描述

# xerr
plt.barh(a, b, color='cyan', xerr=[0.4,0.3,0.1,0.2,0.6],align='center')

在这里插入图片描述
ecolor

plt.bar(a, b, width=0.5, color='cyan', yerr=[1,1.1,1.2,1.3,1.4],ecolor='red',align='center')

在这里插入图片描述
capsize

# default: 3, 这里我设置的是4
plt.bar(a, b, width=0.5, color='cyan', yerr=[1,1.1,1.2,1.3,1.4],capsize=4,align='center')

在这里插入图片描述

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Vergil_Zsh

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值