blob: fbb250ff7f2f4c0f8fb5cd3d7712945257ba0413 (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/bin/sh
#
# rudimental script to plot two csv data sets
#
# Copyright (c) 2015, Aliaksei Katovich <aliaksei.katovich at gmail.com>
#
# Licensed under the GNU General Public License version 2 (GPLv2).
color1="#000070"
color2="#007000"
bg="grey80"
fg="black"
_init()
{
echo "set obj 1 rectangle behind from screen 0,0 to screen 1,1"
echo "set obj 1 fillstyle solid 1.0 fillcolor rgb '$bg'"
echo "set term wxt font 'Arial Bold,9'"
echo "set title '$name1 vs $name2' tc rgb '$fg'"
echo "set key left Left"
echo "set key tc rgb '$fg'"
echo "set xtic auto"
echo "set xlabel 'Time in seconds' tc rgb '$fg' offset 0,-4"
echo "set xtics rotate by 90 offset 0,-4"
echo "set ylabel '$name1 (mA)' tc rgb '$color1'"
echo "set ytic auto nomirror tc lt 1"
echo "set y2label '$name2 (mA)' tc rgb '$color2'"
echo "set y2tic auto nomirror tc lt 2"
echo "set border 1 lt rgb '$fg'"
echo "set grid lt 0 lw 1 lc rgb '$fg'"
echo "set ytics tc rgb '$fg'"
echo "set y2tics tc rgb '$fg'"
echo "set style data lines"
echo "set datafile separator ','"
echo "f(x) = mean_y"
echo "fit f(x) '$file1' u 1:3 via mean_y"
echo "f(x) = mean_y2"
echo "fit f(x) '$file2' u 1:3 via mean_y2"
echo -n "plot '$file1' u 1:3 "
echo -n "title sprintf('$name1 mean %.06f mA', mean_y) "
echo -n "lt 1 lc rgb '$color1' axes x1y1,"
echo -n "'$file2' u 1:3 "
echo -n "title sprintf('$name2 mean %.06f mA', mean_y2) "
echo "lt 2 lc rgb '$color2' axes x1y2"
}
file1=$1
file2=$2
if [ -z "$file2" ]; then
echo "Usage: $(basename $0) <data1.csv> <data2.csv>"
exit 1
fi
name1=$(basename $file1)
name2=$(basename $file2)
_init | gnuplot -noraise -p
|