【问题标题】:How can I draw an errorbar graph without lines and points in Matplotlib?如何在 Matplotlib 中绘制没有线和点的误差线图?
【发布时间】:2020-01-13 21:20:19
【问题描述】:

我目前正在使用以下代码来绘制误差线图。

plt.errorbar(log_I_mean_, log_V2_mean_, xerr, yerr, '.')

但是,最终结果会在每个误差线交点的中心显示一个圆形点。如何按照科学工作的要求仅绘制没有中心点的误差线?

【问题讨论】:

标签: python matplotlib errorbar


【解决方案1】:

使用'none' 代替'.'

import matplotlib.pyplot as plt

x = np.arange(0.1, 4, 0.5)
y = np.exp(-x)

yerr = 0.1 + 0.2*np.sqrt(x)
xerr = 0.1 + yerr

plt.figure()
plt.errorbar(x, y, 0.2, 0.4,'none')
plt.title("Simplest errorbars, 0.2 in x, 0.4 in y")

结果:

附:这是 pylab here 部分示例的略微修改版

【讨论】:

    猜你喜欢
    • 2015-06-06
    • 1970-01-01
    • 1970-01-01
    • 2017-08-13
    • 2021-11-29
    • 1970-01-01
    • 2023-03-13
    • 2019-08-03
    • 1970-01-01
    相关资源
    最近更新 更多