From bafc8b528bcc589b68a467214c1f55b2903b6419 Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Thu, 4 Sep 2008 10:16:41 -0400 Subject: add scatter plottin support --- plot_scatter | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 plot_scatter (limited to 'plot_scatter') diff --git a/plot_scatter b/plot_scatter new file mode 100755 index 0000000..c92c11a --- /dev/null +++ b/plot_scatter @@ -0,0 +1,74 @@ +#!/bin/bash + +#NICE="blacktext linewidth 4.0 \"Helvetica\" 16 " + +# try thinner lines +NICE="blacktext linewidth 1.0 \"Helvetica\" 16 " + +if [ "$1" == "--eps" ]; then + EXT="eps" + TERMINAL="postscript color eps $NICE" + shift +else + EXT="png" + TERMINAL="png picsize 1024 768" +fi + + +OUT=$1 +XLABEL=$2 +YLABEL=$3 +TITLE=$4 +shift 4 + +PLOT="plot " + + +while [ ! -z "$1" ] && [ ! -z "$2" ] && [ ! -z "$3" ] && [ ! -z "$4" ]; do + CSV=$1 + COL1=$2 + COL2=$3 + NAME=$4 + PLOT="$PLOT '${CSV}' using ${COL1}:${COL2} title '${NAME}' with points" + shift 4 + if [ ! -z "$1" ]; then + PLOT="$PLOT, " + fi +done + +#echo $OUT +#echo $XLABEL +#echo $YLABEL +#echo $TITLE +#echo $PLOT + +if [ "$PLOT" = "plot " ]; then + echo "Usage: $0 [--eps] "\ + "(<csv file> <column1> <column2> <label>)+" + exit 1 +fi + +OUT="${OUT}.${EXT}" + +# fixup csv file, gnuplot is picky +#sed -i -e 's/,\([^ ]\)/, \1/g' $CSV1 + +gnuplot <<EOM +set terminal $TERMINAL +set out '/dev/null' +$YRANGE +$XRANGE +$PLOT +set ylabel '$YLABEL' +set xlabel '$XLABEL' +set title '$TITLE' +set key below +set data style points +set out '$OUT' +replot +set out +EOM + +if [ "$EXT" == "eps" ]; then + ps2pdf -dEPSCrop $OUT +fi -- cgit v1.2.2