ulps: Fix long lines
[mathlib.git] / etc / csv2plot.sh
CommitLineData
73bb5f5d
SK
1#!/bin/sh
2
8e1a3161 3DESTDIR=graphs/
4
73bb5f5d
SK
5plot1dfile()
6{
7 cat > 1dscript.plot <<EOF
8set terminal png
8e1a3161 9set out '$DESTDIR/$1.png'
73bb5f5d 10set logscale x
ce4df708 11set xlabel "x (logscale)"
04613b08 12set ylabel "t"
73bb5f5d
SK
13plot '$1'
14EOF
15gnuplot 1dscript.plot
16}
17
18plot2dfile()
19{
20 cat > 2dscript.plot <<EOF
21set terminal png
8e1a3161 22set out '$DESTDIR/$1.png'
73bb5f5d
SK
23set logscale x
24set logscale y
ce4df708 25set xlabel "x (logscale)"
26set ylabel "y (logscale)"
04613b08 27set zlabel "t"
73bb5f5d
SK
28set view 60,30
29set style data lines
04613b08 30set dgrid3d 50,50,50
73bb5f5d
SK
31splot '$1'
32EOF
33gnuplot 2dscript.plot
34}
35
36for i in *.csv;
37do
38 {
39 read header
40 if [ "$header" = "#1" ];
41 then
42 plot1dfile "$i"
43 fi
44
45 if [ "$header" = "#2" ];
46 then
47 plot2dfile "$i"
48 fi
49 } < "$i"
50done