#! /bin/csh -f # Last edited on 2012-05-03 20:25:35 by stolfilocal set usage = "$0 [-noylabels] CONST AFILE ATITLE BFILE BTITLE ..." # The CONST is the constant for the ideal Zipf plot. # Input files must have records of the form # LENGTH COUNT FREQ ... # Uses the "FREQ" column to plot. set ylabelfmt = "%g"; while ( ( $#argv > 0 ) && ( "/$1" =~ /-.* ) ) if ( ( $#argv >= 1 ) && ( "/$1" == "/-noylabels" ) ) then set ylabelfmt = ""; shift else echo "bad option"; echo "usage: ${usage}"; exit 1 endif end if ( $#argv < 3 ) then echo "usage: ${usage}"; exit 1 endif set const = "$1"; shift set pfile = "/tmp/$$.gnuplot" set ofile = "/tmp/$$.eps" cat > ${pfile} <5000 ? 0/0 : const/x)) notitle with lines linetype 3' >> ${pfile} set sep = "," set ltype = ( 1 2 2 3 3 4 4 5 5 ) set ptype = ( 4 2 3 1 6 7 8 1 2 ) @ i = 1 while ( $#argv > 0 ) if ( $#argv < 2 ) then echo "usage: ${usage}"; exit 1 endif set file = "$1"; shift set title = "$1"; shift printf '%s \\\n "%s" using ($0+1):2 title "%s"' \ "${sep}" "${file}" "${title}" >> ${pfile} printf ' \\\n with linespoints lt %d pt %d' \ "${ltype[$i]}" "${ptype[$i]}" >> ${pfile} set sep = "," @ i = $i + 1 end printf '\n' >> ${pfile} printf 'quit\n' >> ${pfile} gnuplot < ${pfile} cat ${ofile} ghostview ${ofile} /bin/rm -f ${ofile} ${pfile}