#! /bin/csh -f # Last edited on 2008-02-04 20:50:10 by stolfi set usage = "$0 [-format eps|png] [-size NUM,NUM] [-xmax NUM] [-ymax NUM] AFILE ATITLE AFLD ALT ASCALE BFILE BTITLE BFLD BLT BSCALE ..." # Plots indicated field against position in file. set size = "1.50,0.75" set format = "eps" set ymax = "100" set xmax = "400" while ( ( $#argv > 0 ) && ( "/$1" =~ /-* ) ) if ( ( $#argv >= 2 ) && ( "/$1" == "/-format" ) ) then set format = "$2"; shift; shift else if ( ( $#argv >= 2 ) && ( "/$1" == "/-size" ) ) then set size = "$2"; shift; shift else if ( ( $#argv >= 2 ) && ( "/$1" == "/-ymax" ) ) then set ymax = "$2"; shift; shift; else if ( ( $#argv >= 2 ) && ( "/$1" == "/-xmax" ) ) then set xmax = "$2"; shift; shift; else echo "bad option"; echo "usage: ${usage}"; exit 1 endif end if ( $#argv < 5 ) then echo "usage: ${usage}"; exit 1 endif set pfile = "/tmp/$$.gnuplot" set ofile = "/tmp/$$.${format}" if ( "/${format}" == "/eps" ) then set fmtline = 'postscript eps mono "TimesRoman" 24' set ltype = ( 1 2 3 4 5 6 7 8 9 ) set ptype = ( 7 1 2 3 4 6 5 8 9 ) else if ( "/${format}" == "/png" ) then set fmtline = 'png medium color; set size 0.75,0.75' set ltype = ( 3 1 5 7 8 9 4 2 6 ) set ptype = ( 1 2 3 4 5 6 7 8 9 ) else echo "invalid plot file format" endif set showpng = display cat > ${pfile} < 0 ) if ( $#argv < 5 ) then echo "usage: ${usage}"; exit 1 endif set file = "$1"; shift set title = "$1"; shift set fld = "$1"; shift set ltx = "$1"; shift set scale = "$1"; shift printf '%s \\\n "%s" using ($0+0.375+(%s/2.5)):(column(%d)*%s) title "%s"' \ "${sep}" "${file}" "${i}" "${fld}" "${scale}" "${title}" >> ${pfile} printf ' \\\n with histeps lt %d' \ "${ltype[$ltx]}" >> ${pfile} set sep = "," @ i = $i + 1 end printf '\n' >> ${pfile} printf 'quit\n' >> ${pfile} /usr/bin/gnuplot < ${pfile} cat ${ofile} if ( "/${format}" == "/eps" ) then ( ghostview ${ofile} && /bin/rm -f ${ofile} ) & else if ( "/${format}" == "/png" ) then ( ${showpng} ${ofile} && /bin/rm -f ${ofile} ) & else echo "invalid plot file format" endif /bin/rm -f ${pfile}