aboutsummaryrefslogtreecommitdiffstats
path: root/plot_scatter
diff options
context:
space:
mode:
Diffstat (limited to 'plot_scatter')
-rwxr-xr-xplot_scatter74
1 files changed, 74 insertions, 0 deletions
diff --git a/plot_scatter b/plot_scatter
new file mode 100755
index 0000000..c92c11a
--- /dev/null
+++ b/plot_scatter
@@ -0,0 +1,74 @@
1#!/bin/bash
2
3#NICE="blacktext linewidth 4.0 \"Helvetica\" 16 "
4
5# try thinner lines
6NICE="blacktext linewidth 1.0 \"Helvetica\" 16 "
7
8if [ "$1" == "--eps" ]; then
9 EXT="eps"
10 TERMINAL="postscript color eps $NICE"
11 shift
12else
13 EXT="png"
14 TERMINAL="png picsize 1024 768"
15fi
16
17
18OUT=$1
19XLABEL=$2
20YLABEL=$3
21TITLE=$4
22shift 4
23
24PLOT="plot "
25
26
27while [ ! -z "$1" ] && [ ! -z "$2" ] && [ ! -z "$3" ] && [ ! -z "$4" ]; do
28 CSV=$1
29 COL1=$2
30 COL2=$3
31 NAME=$4
32 PLOT="$PLOT '${CSV}' using ${COL1}:${COL2} title '${NAME}' with points"
33 shift 4
34 if [ ! -z "$1" ]; then
35 PLOT="$PLOT, "
36 fi
37done
38
39#echo $OUT
40#echo $XLABEL
41#echo $YLABEL
42#echo $TITLE
43#echo $PLOT
44
45if [ "$PLOT" = "plot " ]; then
46 echo "Usage: $0 [--eps] <outfile> <X label> <Y label> <title> "\
47 "(<csv file> <column1> <column2> <label>)+"
48 exit 1
49fi
50
51OUT="${OUT}.${EXT}"
52
53# fixup csv file, gnuplot is picky
54#sed -i -e 's/,\([^ ]\)/, \1/g' $CSV1
55
56gnuplot <<EOM
57set terminal $TERMINAL
58set out '/dev/null'
59$YRANGE
60$XRANGE
61$PLOT
62set ylabel '$YLABEL'
63set xlabel '$XLABEL'
64set title '$TITLE'
65set key below
66set data style points
67set out '$OUT'
68replot
69set out
70EOM
71
72if [ "$EXT" == "eps" ]; then
73 ps2pdf -dEPSCrop $OUT
74fi