绘制限制型误差条形图

误差条上的上限符号和下限符号的说明

  1. import numpy as np
  2. import matplotlib.pyplot as plt
  1. fig = plt.figure(0)
  2. x = np.arange(10.0)
  3. y = np.sin(np.arange(10.0) / 20.0 * np.pi)
  4. plt.errorbar(x, y, yerr=0.1)
  5. y = np.sin(np.arange(10.0) / 20.0 * np.pi) + 1
  6. plt.errorbar(x, y, yerr=0.1, uplims=True)
  7. y = np.sin(np.arange(10.0) / 20.0 * np.pi) + 2
  8. upperlimits = np.array([1, 0] * 5)
  9. lowerlimits = np.array([0, 1] * 5)
  10. plt.errorbar(x, y, yerr=0.1, uplims=upperlimits, lolims=lowerlimits)
  11. plt.xlim(-1, 10)

限制型误差条形图示;

  1. fig = plt.figure(1)
  2. x = np.arange(10.0) / 10.0
  3. y = (x + 0.1)**2
  4. plt.errorbar(x, y, xerr=0.1, xlolims=True)
  5. y = (x + 0.1)**3
  6. plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits)
  7. y = (x + 0.1)**4
  8. plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True)
  9. plt.xlim(-0.2, 2.4)
  10. plt.ylim(-0.1, 1.3)
  11. plt.show()

限制型误差条形图示2;

下载这个示例