- Notifications
You must be signed in to change notification settings - Fork 5
/
Copy patherrorbar.py
35 lines (26 loc) · 655 Bytes
/
errorbar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
==============
Errorbar graph
==============
Using :class:`.containers.ArrayContainer` and :class:`.wrappers.ErrorbarWrapper`
to plot a graph with error bars.
"""
importmatplotlib.pyplotasplt
importnumpyasnp
fromdata_prototype.wrappersimportErrorbarWrapper
fromdata_prototype.containersimportArrayContainer
x=np.arange(10)
y=x**2
yupper=y+np.sqrt(y)
ylower=y-np.sqrt(y)
xupper=x+0.5
xlower=x-0.5
ac=ArrayContainer(
x=x, y=y, yupper=yupper, ylower=ylower, xlower=xlower, xupper=xupper
)
fig, ax=plt.subplots()
ew=ErrorbarWrapper(ac)
ax.add_artist(ew)
ax.set_xlim(0, 10)
ax.set_ylim(0, 100)
plt.show()