【问题标题】:How to change the marker symbol of errorbar limits in matplotlib?如何更改 matplotlib 中误差线限制的标记符号?
【发布时间】:2020-03-16 15:23:20
【问题描述】:

只是一个简单的问题,我在 plt.errorbar documentation 中找不到任何有用的信息

我想用误差线绘制值:

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

但我希望误差线带有一条简单的水平线,而不是末端的箭头。但是plt.errorbar() 函数中没有“capmarker”或类似选项

【问题讨论】:

    标签: python matplotlib marker errorbar


    【解决方案1】:

    删除uplims=Truelolims=True;两个界限都是默认绘制的,没有任何结束箭头:

    import matplotlib.pyplot as plt
    
    plt.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)
    

    【讨论】:

    • 感谢您的快速回答!抱歉,我的描述具有误导性。我想在颜色条的末尾有水平线而不是箭头。
    • 很好的答案!感谢@BigBen,这应该在文档中得到更好的解释/展示
    猜你喜欢
    • 2012-03-20
    • 1970-01-01
    • 2011-11-27
    • 2021-01-14
    • 2015-06-06
    • 1970-01-01
    • 2013-09-08
    • 1970-01-01
    • 2021-11-19
    相关资源
    最近更新 更多