#!/usr/bin/perl
#
# Make plots showing trajectories of pitches from several different angles
# 
# MWR 8/6/2008

if (0 == 1) {
  
    
      my($output_file, $term_options);
    
      #
      #    90 MPH fastball in vacuum, 3rd base view
      #
      # get the arguments
      $output_file = "./traj_a.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view, circles every 0.10 seconds' \n";
      
      $cmd = "plot [60:-3][0:8] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.A.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball in a vacuum' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 ";
      $cmd .= " , ";
      $cmd .= " './traj.A.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 1 ";
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
      #
      #    90 MPH fastball in vacuum, and 90 MPH fastball with drag only
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_b.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view, circles every 0.10 seconds' \n";
      
      $cmd = "plot [60:-3][1.5:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.A.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball in a vacuum' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 ";
      $cmd .= " , ";
      $cmd .= " './traj.A.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 1 ";
      $cmd .= " , ";
      $cmd .= " './traj.B.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.B.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
      #
      #    90 MPH fastball with drag only, hitting center of strike zone
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_c.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view of the \"reference fastball\" ' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.C.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag only' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.C.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
      #
      #    90 MPH fastball with drag only,
      #           90 MPH fastball with 2200 RPM backspin
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_d.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view of a realistic fastball ' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.C.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag only' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.C.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.D.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 1 ";
      $cmd .= " , ";
      $cmd .= " './traj.D.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 1 ";
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
      #  a truly "rising" fastball
      #      100 MPH fastball with 3000 RPM backspin, 
      #           given initial motion purely horizontal
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_j.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left reverse samplen 0.2 \n";
      #printf CMDFILE "set label 1 'Height of fastball at t=0.230 seconds ' ";
      #printf CMDFILE "    at 55,4.25 \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view of a truly \"rising\" fastball ' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.C.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag only' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.C.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.O.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '110 MPH fastball with drag and 3500 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 1 ";
      $cmd .= " , ";
      $cmd .= " './traj.O.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 1 ";
    
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
    
    
      #
      #       90 MPH fastball with 2200 RPM backspin, centered in zone
      #           80 MPH changeup with 1300 RPM backspin, same angles
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_e.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view of centered fastball, changeup with same release' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.E.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.E.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.F.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH changeup with drag and 1300 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.F.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 2 lt 2 ";
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
      #
      #       90 MPH fastball with 2200 RPM backspin, centered in zone
      #           80 MPH curveball with 1300 RPM topspin, same angles
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_f.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left reverse samplen 0.2 \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view of centered fastball, curve with same release ' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.E.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.E.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.G.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH curve with drag and 1300 RPM topspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 3 ";
      $cmd .= " , ";
      $cmd .= " './traj.G.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 3 ";
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
      #
      #       90 MPH fastball with 2200 RPM backspin, centered in zone
      #           80 MPH curveball with 1300 RPM topspin, centerted in zone
      #           80 MPH changeup  with 1300 RPM backspin, centerted in zone
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_g.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left reverse samplen 0.2 \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view of centered pitches ' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.E.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.E.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.I.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH changeup with drag and 1300 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.I.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.H.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH curve with drag and 1300 RPM topspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 3 ";
      $cmd .= " , ";
      $cmd .= " './traj.H.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 3 ";
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
    
      #
      #       90 MPH fastball with 2200 RPM backspin, centered in zone
      #           80 MPH changeup  with 1300 RPM backspin, 
      #                                crosses fastball at reaction time
      #           80 MPH curve     with 1300 RPM topspin, 
      #                                crosses fastball at reaction time
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_h.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left reverse samplen 0.2 \n";
      printf CMDFILE "set label 1 'Height of fastball at t=0.230 seconds ' ";
      printf CMDFILE "    at 55,4.25 \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view of \"disguised\" pitches: same height at t=0.230 seconds ' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.E.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.E.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= "  (1.435/0.3048) with lines lt -1  t '' ";
      $cmd .= " , ";
      $cmd .= " './traj.J.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH changeup with drag and 1300 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.J.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.K.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH curve with drag and 1300 RPM topspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 3 ";
      $cmd .= " , ";
      $cmd .= " './traj.K.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 3 ";
    
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
      #
      #       90 MPH fastball with 2200 RPM backspin, centered in zone
      #           80 MPH changeup  with 1300 RPM backspin, 
      #                                crosses fastball at reaction time
      #           80 MPH curve     with 1300 RPM topspin, 
      #                                crosses fastball at reaction time
      #       batter's view
      #
      # get the arguments
      $output_file = "./traj_h2.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left reverse samplen 0.2 \n";
      printf CMDFILE "set object 1 rect from 2,-1 to 8,-4 ";
      printf CMDFILE "    back fs empty border 1 lw 5   \n";
      printf CMDFILE "set label 1 'Batter must react now' at 10,-3 textcolor lt 1 \n";
      printf CMDFILE "set xlabel 'Angle away from mound-plate line (degrees) ' \n";
      printf CMDFILE "set ylabel 'Angle above horizontal (degrees) \n";
      printf CMDFILE "set title 'Batter view of \"disguised\" pitches: same height at t=0.230 seconds ' \n";
      
      $cmd = "plot [-5:50][-60:5] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.E.dat' index 0 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.E.dat' index 1 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.J.dat' index 0 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '80 MPH changeup with drag and 1300 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.J.dat' index 1 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.K.dat' index 0 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '80 MPH curve with drag and 1300 RPM topspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 3 ";
      $cmd .= " , ";
      $cmd .= " './traj.K.dat' index 1 ";
      $cmd .= "    using (\$15+180):(\$14) ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 3 ";
    
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
    
    
      #
      #       90 MPH fastball with 2200 RPM backspin, centered in zone
      #           80 MPH changeup  with 1300 RPM backspin, 
      #                                crosses fastball trajectory at h=1.37 m
      #           80 MPH curve     with 1300 RPM topspin, 
      #                                crosses fastball trajectory at h=1.37 m
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_i.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left reverse samplen 0.2 \n";
      printf CMDFILE "set label 1 'Height of fastball at t=0.230 seconds ' ";
      printf CMDFILE "    at 55,4.25 \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view of \"disguised\" pitches: same height at 25.7 feet from plate ' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.E.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.E.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= "  (1.435/0.3048) with lines lt -1  t '' ";
      $cmd .= " , ";
      $cmd .= " './traj.N.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH changeup with drag and 1300 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.N.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.M.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH curve with drag and 1300 RPM topspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 3 ";
      $cmd .= " , ";
      $cmd .= " './traj.M.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 3 ";
    
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
      #
      #       90 MPH fastball with 2200 RPM backspin, centered in zone
      #           80 MPH changeup  with 1300 RPM backspin, 
      #                                crosses fastball location in space
      #           80 MPH curve     with 1300 RPM topspin, 
      #                                crosses fastball location in space
      #       batter's view
      #
      # get the arguments
      $output_file = "./traj_i2.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left reverse samplen 0.2 \n";
      printf CMDFILE "set object 1 rect from 2,-1 to 8,-4 ";
      printf CMDFILE "    back fs empty border 1 lw 5   \n";
      printf CMDFILE "set label 1 'Batter must react now' at 10,-3 textcolor lt 1 \n";
      printf CMDFILE "set xlabel 'Angle away from mound-plate line (degrees) ' \n";
      printf CMDFILE "set ylabel 'Angle above horizontal (degrees) \n";
      printf CMDFILE "set title 'Batter view of \"disguised\" pitches: same height at 25.7 feet from plate ' \n";
      
      $cmd = "plot [-5:50][-60:5] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.E.dat' index 0 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.E.dat' index 1 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.N.dat' index 0 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '80 MPH changeup with drag and 1300 RPM backspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.N.dat' index 1 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 2 ";
      $cmd .= " , ";
      $cmd .= " './traj.M.dat' index 0 ";
      $cmd .= "    using (\$15+180):(\$14)  ";
      $cmd .= "    t '80 MPH curve with drag and 1300 RPM topspin' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 3 ";
      $cmd .= " , ";
      $cmd .= " './traj.M.dat' index 1 ";
      $cmd .= "    using (\$15+180):(\$14) ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 3 ";
    
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
    
    
      #  third-base views of the twelve-o-clock curve
      #              and the        one-o-clock curve
      #
      # get the arguments
      $output_file = "./traj_k.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left reverse samplen 0.2 \n";
      #printf CMDFILE "set label 1 'Height of fastball at t=0.230 seconds ' ";
      #printf CMDFILE "    at 55,4.25 \n";
      printf CMDFILE "set xlabel 'Distance from pitcher (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third-base view of two curveballs ' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.H.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH twelve-o-clock curveball ' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.H.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.P.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH one-o-clock curveball ' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 1 ";
      $cmd .= " , ";
      $cmd .= " './traj.P.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 1 ";
    
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    
    
    
    
      #  catcher's  views of the twelve-o-clock curve
      #              and the        one-o-clock curve
      #
      # get the arguments
      $output_file = "./traj_l.ps";
      $term_options = "postscript color enhanced ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left reverse samplen 0.2 \n";
      #printf CMDFILE "set label 1 'Height of fastball at t=0.230 seconds ' ";
      #printf CMDFILE "    at 55,4.25 \n";
      # this is the strike zone
      printf CMDFILE "set object 1 rectangle from -0.950,1.6 to 0.950,3.56 ";
      printf CMDFILE "     back fc lt 3 fs solid 0.1 \n";
      printf CMDFILE "set xlabel 'Distance from center of home plate (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Catcher view of two curveballs ' \n";
      
      $cmd = "plot [2.5:-2.5][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.H.dat' index 0 ";
      $cmd .= "    using (0.0+(\$7/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH twelve-o-clock curveball ' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.H.dat' index 1 ";
      $cmd .= "    using (0.0+(\$7/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt -1 ";
      $cmd .= " , ";
      $cmd .= " './traj.P.dat' index 0 ";
      $cmd .= "    using (0.0+(\$7/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH one-o-clock curveball ' ";
      $cmd .= "    with points ps 0.5 pt 3 lw 3 lt 1 ";
      $cmd .= " , ";
      $cmd .= " './traj.P.dat' index 1 ";
      $cmd .= "    using (0.0+(\$7/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 1.5 pt 6 lw 1 lt 1 ";
    
    
    
      printf CMDFILE "$cmd \n";
      printf CMDFILE "set output \n";
      printf CMDFILE "quit \n";
      close(CMDFILE) ;
      
      $retval = `gnuplot < $cmdfile`;
      printf "retval is ..%s..\n", $retval;
      
      if ($term_options =~ /postscript/) {
        $psfile = $output_file;
        $giffile = $psfile;
        $giffile =~ s/.eps/.gif/;
        $giffile =~ s/.ps/.gif/;
        $cmd = "convert -rotate 90 $psfile $giffile";
        printf "cmd is ..$cmd.. \n";
        $ret = `$cmd`;
      }
    

}

  #
  #    90 MPH fastball with drag only,
  #           90 MPH fastball with 2200 RPM backspin
  #           90 MPH "curveball" with 2200 RPM topspin
  #       3rd base view
  #
  # get the arguments
  $output_file = "./traj_q.ps";
  $term_options = "postscript color enhanced 'Helvetica,22' ";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set size 1.3,1.3 \n";
  printf CMDFILE "set border linewidth 2 \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key bot left \n";
  printf CMDFILE "set xlabel 'Distance from batter (feet) ' \n";
  printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
  printf CMDFILE "set title 'Third base view of pitches with different spin ' \n";
  
  $cmd = "plot [60:-3][0.0:7] ";
#  $cmd = "plot [][] ";
  $cmd .= " './traj.C.dat' index 0 ";
  $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
  $cmd .= "    t '90 MPH pitch with drag only' ";
  $cmd .= "    with points ps 0.8 pt 3 lw 3 lt -1 ";
  $cmd .= " , ";
  $cmd .= " './traj.C.dat' index 1 ";
  $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
  $cmd .= "    t '' ";
  $cmd .= "    with points ps 2.0 pt 6 lw 2 lt -1 ";
  $cmd .= " , ";
  $cmd .= " './traj.D.dat' index 0 ";
  $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
  $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
  $cmd .= "    with points ps 0.8 pt 3 lw 3 lt 1 ";
  $cmd .= " , ";
  $cmd .= " './traj.D.dat' index 1 ";
  $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
  $cmd .= "    t '' ";
  $cmd .= "    with points ps 2.0 pt 6 lw 2 lt 1 ";
  $cmd .= " , ";
  $cmd .= " './traj.Q.dat' index 0 ";
  $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
  $cmd .= "    t '90 MPH curveball with drag and 2200 RPM topspin' ";
  $cmd .= "    with points ps 0.8 pt 3 lc 3 lw 3 lt 1 ";
  $cmd .= " , ";
  $cmd .= " './traj.Q.dat' index 1 ";
  $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
  $cmd .= "    t '' ";
  $cmd .= "    with points ps 2.0 pt 6 lc 3 lw 2 lt 1 ";


  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.png/;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


    
      #
      #       90 MPH fastball with 2200 RPM backspin, centered in zone
      #           80 MPH curveball with 1300 RPM topspin, centerted in zone
      #       3rd base view
      #
      # get the arguments
      $output_file = "./traj_g2.ps";
      $term_options = "postscript color enhanced 'Helvetica,22' ";
    
      $cmdfile = "gnuplot.in";
      
      open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
      printf CMDFILE "set output '$output_file' \n";
      printf CMDFILE "set term $term_options \n";
      printf CMDFILE "set size 1.3,1.3 \n";
      printf CMDFILE "set border linewidth 2 \n";
      printf CMDFILE "set grid \n";
      printf CMDFILE "set key bot left  \n";
      printf CMDFILE "set xlabel 'Distance from batter (feet) ' \n";
      printf CMDFILE "set ylabel 'Height above ground (feet)' \n";
      printf CMDFILE "set title 'Third base view of centered pitches ' \n";
      
      $cmd = "plot [60:-3][0.0:7] ";
    #  $cmd = "plot [][] ";
      $cmd .= " './traj.E.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '90 MPH fastball with drag and 2200 RPM backspin' ";
      $cmd .= "    with points ps 0.8 pt 3 lw 3 lt 1 lc 1 ";
      $cmd .= " , ";
      $cmd .= " './traj.E.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 2.0 pt 6 lw 1 lt 1 lc 1 ";
      $cmd .= " , ";
      $cmd .= " './traj.H.dat' index 0 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '80 MPH curve with drag and 1300 RPM topspin' ";
      $cmd .= "    with points ps 0.8 pt 3 lw 3 lt 1 lc 3 ";
      $cmd .= " , ";
      $cmd .= " './traj.H.dat' index 1 ";
      $cmd .= "    using (0.0-(\$5/0.3048)):(\$6/0.3048)  ";
      $cmd .= "    t '' ";
      $cmd .= "    with points ps 2.0 pt 6 lw 2 lt 1 lc 3 ";
    
  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.png/;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


    




exit 0;
