a fast script: gplot.csh – quick plotting with gnuplot
This is a simple script which I use often to quickly visualize data. It is in my ~/bin directory since years, so I give it a chance to go public 😉
#! /bin/tcsh # if ("a$1" == "a") then echo "give a file name..." exit endif if ("a$1" == "ahelp") then echo "Usage: $0 [numcols]" echo "" exit endif if ("a$2" == "a") then set numcols=2 else set numcols=$2 endif # # set cnum=2 set pltcmd="plot '$1' using 1:2" while ( $cnum != $numcols ) @ cnum = $cnum + 1 set pltcmd="${pltcmd}, '$1' using 1:${cnum}" end # echo "Plot cmd: $pltcmd" # cat << EOF > x.plot.$$ set style data linespoints $pltcmd pause -1 "Hit return to continue" EOF # gnuplot x.plot.$$ # rm x.plot.$$ #
As example, I use this file:
[mariotti@localhost gplot]$ tail x.data 934 448 934 935 480 935 936 484 936 937 490 937 938 493 938 939 518 939 940 540 940 941 636 941 942 685 942 943 737 943
Then just type: “gplot.csh x.data” to get
or type “gplot.csh x.data 3” to get
I know it is in c-shell (actually I call tcsh) which is not anymore so used, but you can still install it. It is not a so bad thing to do 😉
I use this script for very quick visualization from the command line when I need to have an idea about the data, hope it helps.
Thanks your script came very handy to me!