PLOTS errorbarΒΆ

# -*-Python-*-
# Created by bgrierson at 15 Dec 2016  04:38

# Create a function y(x) with uncertainty
x = linspace(0, 1, 21)
y = np.sin(x * 2.0 * constants.pi)
yerr = np.random.rand(len(y))

# Create an uncertainties array, which has both value and error bar
yarr = uarray(y, yerr)

# Make the plot
fig, ax = plt.subplots(nrows=3)

# uerrorbar has an error bar on each point
uerrorbar(x, yarr, ax=ax[0])
ax[0].set_title('uerrorbar')

# uband is an band encompassing the uncertainty
uband(x, yarr, ax=ax[1])
ax[1].set_title('uband')

# They can be combined
uerrorbar(x, yarr, ax=ax[2], color='c', markersize=2.0)
uband(x, yarr, ax=ax[2], color='c')
ax[2].set_title('combined')