import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
x = np.arange(10)
y = 2.5 * np.sin(x / 20.0 * np.pi)
yerr = np.linspace(0.05, 0.2, 10)
plt.plot(x, y, 'ro')
plt.errorbar(x, y, yerr=yerr, label='both limits (default)', fmt='none', ecolor='gray', capthick=2)
plt.legend(loc='lower right')
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
x = np.arange(10)
y = 2.5 * np.sin(x / 20.0 * np.pi)
print x
print y
yerr = np.linspace(0.05, 0.2, 10)
print yerr
plt.errorbar(x, y + 3, yerr=yerr, label='both limits (default)')
plt.errorbar(x, y + 2, yerr=yerr, uplims=True, label='uplims=True')
plt.errorbar(x, y + 1, yerr=yerr, uplims=True, lolims=True,
label='uplims=True, lolims=True')
upperlimits = [True, False] * 5
lowerlimits = [False, True] * 5
plt.errorbar(x, y, yerr=yerr, uplims=upperlimits, lolims=lowerlimits,
label='subsets of uplims and lolims')
plt.legend(loc='lower right')
[0 1 2 3 4 5 6 7 8 9]
[ 0. 0.39108616 0.77254249 1.13497625 1.46946313 1.76776695
2.02254249 2.22751631 2.37764129 2.46922085]
[ 0.05 0.06666667 0.08333333 0.1 0.11666667 0.13333333
0.15 0.16666667 0.18333333 0.2 ]
fig = plt.figure()
x = np.arange(10.0) / 10
y = (x + 0.1)**2
plt.errorbar(x, y, xerr=0.1, xlolims=True, label='xlolims=True')
y = (x + 0.1)**3
upperlimits = [True, False] * 5
lowerlimits = [False, True] * 5
plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits,
label='subsets of xuplims and xlolims')
y = (x + 0.1)**4
plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True, label='xuplims=True')
plt.legend()
plt.show()
reference:
https://matplotlib.org/3.1.1/gallery/lines_bars_and_markers/errorbar_limits_simple.html#sphx-glr-gallery-lines-bars-and-markers-errorbar-limits-simple-py
https://www.quantopian.com/lectures/autocorrelation-and-ar-models
No comments:
Post a Comment