备注
前往结尾 下载完整示例代码。
Errorbar 函数#
这展示了误差条方法的最基本用法。在这种情况下,为x方向和y方向的误差提供了常数值。
import matplotlib.pyplot as plt
import numpy as np
# example data
x = np.arange(0.1, 4, 0.5)
y = np.exp(-x)
fig, ax = plt.subplots()
ax.errorbar(x, y, xerr=0.2, yerr=0.4)
plt.show()