-
Notifications
You must be signed in to change notification settings - Fork 3
/
river.py
38 lines (31 loc) · 992 Bytes
/
river.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
36
37
38
import sys
import math
data = []
for line in sys.stdin:
x, ymean, ystd = line.split()
x = float(x)
ymean = float(ymean)
ystd = float(ystd)
data.append((x, ymean, ystd))
print(r'\documentclass{standalone}')
print(r'\usepackage{tikz,pgfplots}')
print(r'\usepgfplotslibrary{fillbetween}')
print(r'\begin{document}')
print(r'\begin{tikzpicture}')
print(r' \begin{axis}')
print(r' \addplot[mark=none] coordinates {')
for x, ymean, ystd in data:
print(rf' ({x},{ymean})')
print(r' };')
print(r' \addplot[draw=none,mark=none,name path=above] coordinates {')
for x, ymean, ystd in data:
print(rf' ({x},{ymean+ystd})')
print(r' };')
print(r' \addplot[draw=none,mark=none,name path=below] coordinates {')
for x, ymean, ystd in data:
print(rf' ({x},{ymean-ystd})')
print(r' };')
print(r' \addplot[fill opacity=0.2] fill between[of=above and below];')
print(r' \end{axis}')
print(r'\end{tikzpicture}')
print(r'\end{document}')