Skip to content

Instantly share code, notes, and snippets.

@mariotti
Created September 4, 2015 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariotti/36ca211fc6a083be1494 to your computer and use it in GitHub Desktop.
Save mariotti/36ca211fc6a083be1494 to your computer and use it in GitHub Desktop.
quick plot data with gnuplot
#! /bin/tcsh
#
if ("a$1" == "a") then
echo "give a file name..."
exit
endif
if ("a$1" == "ahelp") then
echo "Usage: $0 <datafilename> [numcols]"
echo ""
exit
endif
if ("a$2" == "a") then
set numcols=2
else
set numcols=$2
endif
#
#
# @ numcols = $numcols + 1
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.$$
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment