如何在matplotlib中更改误差线限制的标记符号? [英] How to change the marker symbol of errorbar limits in matplotlib?

查看:124
本文介绍了如何在matplotlib中更改误差线限制的标记符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是一个简单的问题,在

但是我希望误差条带有一条简单的水平线,而不是两端的箭头.但是 plt.errorbar()函数

中没有"capmarker"或类似的选项

解决方案

删除 uplims = True lolims = True ;默认情况下绘制两个限制,没有任何结束箭头:

 将matplotlib.pyplot导入为pltplt.errorbar(1,0.25,yerr = 0.1,fmt ='o')plt.show() 

编辑:

增加 capsize 可以在误差线的末尾添加大写字母,并增加 capthick 可以使大写字母更厚:

  plt.errorbar(1,0.25,yerr = 0.1,fmt ='o',capsize = 3) 

  plt.errorbar(1,0.25,yerr = 0.1,fmt ='o',capsize = 3,capthick = 3) 

just a quick question, where I couldn't find anything helpful in the plt.errorbar documentation

I want to plot values with error bars:

import matplotlib.pyplot as plt
plt.errorbar(1, 0.25, yerr=0.1, uplims=True, lolims=True, fmt='o')
plt.show()

But I would like to have error bars with a simple horizontal line instead of arrows at the ends. But there is no "capmarker" or similar option in the plt.errorbar() function

解决方案

Remove the uplims=True and lolims=True; both limits are plotted by default, without any ending arrows:

import matplotlib.pyplot as plt

plt.errorbar(1, 0.25, yerr=0.1, fmt='o')
plt.show()

EDIT:

Increase the capsize to add caps to the end of the error bars, and increase the capthick to make the caps thicker:

plt.errorbar(1, 0.25, yerr=0.1, fmt='o', capsize=3)

plt.errorbar(1, 0.25, yerr=0.1, fmt='o', capsize=3, capthick=3)

这篇关于如何在matplotlib中更改误差线限制的标记符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆