是否有可能有一个上限(带有向下箭头),其中点以最佳值为中心,同时还有误差上限?
像这样的东西:
我正在尝试:
import numpy as np
import matplotlib.pyplot as plt
x = np.array([10, 15, 20, 25, 30, 35])
x_el = np.array([1, 1, 2, 25, 1, 2, 1])
x_eu = np.array([1, 1, 2, 1, 1, 2, 1])
y = np.array([29, 15, 9, 10, 25, 14])
y_el = np.array([1, 1, 2, 1, 1, 2, 1])
y_eu = np.array([11,1,2,1,1,2,1])
fig, ax = plt.subplots()
for i in range(len(x)):
if (x[i] - x_el[i]) == 0:
el = 0
ax.errorbar(x[i], y[i], yerr=[[y_el[i]], [y_eu[i]]], xerr=[[el],[x_eu[i]]],
c='b', capsize=2, elinewidth=1, marker='o',
xuplims=True)
else:
ax.errorbar(x[i], y[i], yerr=[[y_el[i]], [y_eu[i]]], xerr=[[x_el[i]], [x_eu[i]]],
c='b', capsize=2, elinewidth=1, marker='o')
但这是结果:
第 4 点既没有上限也没有上限误差。
相关分类