【问题标题】:How to only show upper error bar and not lower error bar in a bar graph in python?如何在python的条形图中只显示上部误差条而不显示下部误差条?
【发布时间】:2021-11-16 11:35:58
【问题描述】:

我只想显示上部错误栏而不显示下部错误栏 bar graph here

mean.plot.bar()
plt.title('Liquid Intake')
plt.ylabel('Intake(ml)')
x = ['Sucralose','Sucrose','Water']
plt.errorbar(x, mean, yerr=SEM, ecolor='black', capsize = 3, fmt=' ')

谢谢!

【问题讨论】:

标签: python bar-chart errorbar


【解决方案1】:

只是为了更新,我决定让误差条颜色与条本身的颜色相同,从而掩盖条形下限。万一其他人有这个问题,这是一种解决方案......

编辑

没关系,我包含代码 zorder=0 以将错误栏放在栏后面

plt.errorbar(x1, mean, yerr=(SEM),fmt=' ', capsize=(3),zorder=0, ecolor='k')

希望这对某人有所帮助!

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 2019-01-18
  • 1970-01-01
  • 2014-09-21
  • 1970-01-01
  • 2013-02-20
  • 2012-07-16
  • 1970-01-01
  • 2018-09-28
相关资源
最近更新 更多