#!/usr/local/bin/perl -w # # cd code/SUMMARY # buildable.p < buildable > b.gnu # # R t N M # # gives as output # # set label 1 '$t' at $N,$M # # this allows you to change files on command line $o=0; $logs = 1 ; $bfile = "buildable" ; $showS = 0 ; # whether to show labels at the steiner system points $Mmax = 0 ; $Nmax = 0 ; $Mmax = 550 ; # override automated sizing $S = "Steiner"; eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; $label = 1 ; # open ( O , ">$bfile" ) ; while (<>) { s/^\s*// ; # remove the initial space if ( !(/^\#/) ) { ($R,$t,$N,$M) = split ; if ( ( $showS || !( $t eq "S" ) ) && ( $N > 0 && $M > 0 ) ){ print "set label $label '$t' at $N,$M\n" ; if ( $M > $Mmax ) { $Mmax = $M ; } if ( $N > $Nmax ) { $Nmax = $N ; } $label ++ ; } } # print STDERR "line $label $_" ; } if ( $logs ) { $Nmax = $Nmax * 1.5 ; $Mmax = $Mmax * 1.5 ; print "set logs xy \n" ; if ( $o == 0 ) { $o = 10 ; } } else { $Nmax = $Nmax * 1.15 ; $Mmax = $Mmax * 1.15 ; } #print "set size 0.64,0.64; set xrange [$o:$Nmax] ; set yrange [$o:$Mmax] ;" ; print "set size 0.52,0.52; set xrange [$o:$Nmax] ; set yrange [$o:$Mmax] ;" ; # good for size 0.4,0.4 : print " set key 40,450\n" ; print " set key 40,250\n" ; print " set key 40,350\n" ; print " set key 2040,35\n" ; print "set label 'R=1/3' at 650,500 right\n" ; print "set label '1/2' at 1000,500 left\n" ; print "set label '3/4' at 2000,500 left\n" ; print "set label '8/9' at 4500,500 left\n" ; print "set term postscript ; set output 'buildable.ps' \n" ; print "set samples $Mmax \n" ; print "N(M,j) = M * (M-1.0) / ( j * (j-1.0) ) \n" ; print "set parametric\n" ; #print "plot [2:$Nmax] t,0.66*t t 'R=1/3', t,0.5*t t 'R=1/2', t,0.25*t t 'R=3/4',\\\n" ; #print " t,0.11*t t 'R=8/9'\\\n" ; print "plot [2:$Nmax] t,0.66*t t '' w l 2, t,0.5*t t '' w l 2, t,0.25*t t '' w l 2,\\\n" ; print " t,0.11*t t '' w l 2\\\n" ; print ",N(t,6),t t '$S(j=6)' w l 4\\\n" ; print ",N(t,5),t t '$S(j=5)' w l 3\\\n" ; print ",N(t,4),t t '$S(j=4)' w l 5\\\n" ; print ",N(t,3),t t '$S(j=3)' w l 1\\\n" ; print ", '$bfile' u 3:4 t '' w d 1 1\n" ; print "set term X\n" ; print "replot" ; exit(0); print $R;