-
Notifications
You must be signed in to change notification settings - Fork 2
/
timeplot_all.gpl
executable file
·38 lines (32 loc) · 1.92 KB
/
timeplot_all.gpl
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
#!/usr/bin/gnuplot
reset;
set encoding utf8;
NOW=system("TZ=" . CONFIG_TIMEZONE . " date +%FT%T" . CONFIG_TZ);
set lmargin at screen 0.33;
set key on outside left vertical Right opaque noreverse samplen 1.0 spacing 0.90 height 0.9 title " ID: μSv/h ± 3σ (3σ%) [@DRE2CPM]" noenhanced nobox maxcols 1 maxrows 50;
set grid x y2 front;
S_START=strptime("%Y-%m-%dT%H:%M:%S" . CONFIG_TZ, PERIOD_START);
S_END=strptime("%Y-%m-%dT%H:%M:%S" . CONFIG_TZ, PERIOD_END);
set xrange [ S_START : S_END ]; # set xlabel "timestamp";
unset ytics;
set y2range [-0.1 :+1.1]; set y2tics nomirror textcolor rgb "blue"; set y2label "μSv/h" textcolor rgb "blue";
set arrow 2 nohead front from graph 1, graph 0 to graph 1, graph 1 lc rgb "blue";
set xdata time; set timefmt '"%Y-%m-%dT%H:%M:%S' . CONFIG_TZ . '"'; set format x "%Y-%m-%d\n%H:%M " . CONFIG_TZ;
set format y "% 0.0f"; set format y2 "%0.2f";
set term png noenhanced font "Arial Unicode MS,9" size CONFIG_WIDTH_ALL, CONFIG_HEIGHT_ALL background "#ffffef";
set output OUTFILE;
set title "Safecast fixed sensors: DRE at " . NOW font "Arial Unicode MS,12";
graph_title(n) = system("cat tmp/" . n . ".title");
plot for [ID in IDs] "tmp/" . ID . ".data" u 1:2 axes x1y2 w l lw 1 title graph_title(ID);
exit;
# Plot update window graph
unset for [i in "2"] arrow i; unset key; unset lmargin; set grid x y front; set ytics; unset y2tics; unset y2label;
set datafile separator ",";
set xdata time; set timefmt '%Y-%m-%dT%H:%M:%S' . CONFIG_TZ; set format x "%Y-%m-%d\n%H:%M " . CONFIG_TZ;
set key default; set key bottom center outside maxrows 3;
set term png enhanced font "Arial Unicode MS,9" size 2000,800 background "#ffffef";
OUTFILE=OUTFILE[1:strstrt(OUTFILE,".")-1] . "_window" . OUTFILE[strstrt(OUTFILE,"."):*];
set output OUTFILE;
set title "Safecast fixed sensors: update window at " . NOW font "Arial Unicode MS,12";
set yrange [-10:10*300];
plot for [ID in IDs] "cache/" . ID . ".csv" u 1:5 w l lw 1 title ID;