Diff for /loncom/xml/lonplot.pm between versions 1.8 and 1.9

version 1.8, 2001/12/19 19:22:52 version 1.9, 2001/12/19 22:14:20
Line 380  sub write_gnuplot_file { Line 380  sub write_gnuplot_file {
     push @Colors, $plot{'fgcolor'};       push @Colors, $plot{'fgcolor'}; 
     push @Colors, $axis{'color'};      push @Colors, $axis{'color'};
     push @Colors, $axis{'color'};       push @Colors, $axis{'color'}; 
     foreach $curve (@Curves) {      foreach $curve (@curves) {
  push @Colors, ($curve{'color'} ne '' ?    push @Colors, ($curve->{'color'} ne '' ? 
        $curve{'color'}       :          $curve->{'color'}       : 
        $plot{'fgcolor'}      );         $plot{'fgcolor'}      );
     }      }
     # set term      # set term
     $gnuplot_input .= 'set term gif ';      $gnuplot_input .= 'set term gif ';
     $gnuplot_input .= 'transparent ' if ($plot{'transparent'} eq 'on');      $gnuplot_input .= 'transparent ' if ($plot{'transparent'} eq 'on');
     $gnuplot_input .= $plot{'font'} . ' ';      $gnuplot_input .= $plot{'font'} . ' ';
     $gnuplot_input .= 'size ' . $plot{'width'} . ' ';      $gnuplot_input .= 'size ' . $plot{'width'} . ',';
     $gnuplot_input .= $plot{'height'} . ' ';      $gnuplot_input .= $plot{'height'} . ' ';
     $gnuplot_input .= "@Colors\n";      $gnuplot_input .= "@Colors\n";
     # grid      # grid
     $gnuplot_input .= ($plot->{'grid'} eq 'on' ?      $gnuplot_input .= ($plot{'grid'} eq 'on' ?
        'set grid\n'            :         'set grid'.$/            :
        ''                      );         ''                      );
     # border      # border
     $gnuplot_input .= ($plot->{'border'} eq 'on'?      $gnuplot_input .= ($plot{'border'} eq 'on'?
        'set border\n'           :         'set border'.$/           :
        'set noborder\n'         );    # title, xlabel, ylabel         'set noborder'.$/         );    # title, xlabel, ylabel
     {      {
     $gnuplot_input .<<"ENDLABELS";      $gnuplot_input .= <<"ENDLABELS";
 set title  $title->{'text'}  set output "tmp.gif"
 set xlabel $xlabel->{'text'}  set title  "$title"
 set ylabel $ylabel->{'text'}  set xlabel "$xlabel"
 set xrange $axis->{'xmin'}:$axis->{'xmax'}  set ylabel "$ylabel"
 set yrange $axis->{'ymin'}:$axis->{'ymax'}  set xrange \[$axis{'xmin'}:$axis{'xmax'}\]
   set yrange \[$axis{'ymin'}:$axis{'ymax'}\]
 ENDLABELS  ENDLABELS
     }      }
     # Key      # Key
     if (defined($key{'pos'})) {      if (defined($key{'pos'})) {
  $gnuplot_input .= 'set key '.$key->{'pos'}.' ';   $gnuplot_input .= 'set key '.$key{'pos'}.' ';
  $gnuplot_input .= ($key->{'box'} eq 'on' ? 'box ' : 'nobox ');   $gnuplot_input .= ($key{'box'} eq 'on' ? 'box ' : 'nobox ');
  if ($key->{'title'} ne '') {   if ($key{'title'} ne '') {
     $gnuplot_input .= 'title "'$key->{'title'}.'"\n';      $gnuplot_input .= 'title "'.$key{'title'}.'"'.$/;
  } else {   } else {
     $gnuplot_input .= '\n';      $gnuplot_input .= $/;
  }   }
     } else {      } else {
  $gnuplot_input .= 'set nokey\n';   $gnuplot_input .= 'set nokey'.$/;
     }          }    
     # axis  
     $gnuplot_input .= 'set xrange ['.$axis{'xmin'}.':'.$axis{'xmin'}.']\n';  
     $gnuplot_input .= 'set yrange ['.$axis{'ymin'}.':'.$axis{'ymin'}.']\n';  
     # labels      # labels
     foreach $label (@labels) {      foreach $label (@labels) {
  $gnuplot_input .= 'set label "'.$label->{'text'}.'" at '.   $gnuplot_input .= 'set label "'.$label->{'text'}.'" at '.
     $label->{'x'}.','.$label->{'y'}.'\n';      $label->{'xpos'}.','.$label->{'ypos'}.' '.$label->{'justify'}.$/ ;
     }      }
     # curves      # curves
     $gnuplot_input .= 'plot ';      $gnuplot_input .= 'plot ';
     my $datatext = '';      my $datatext = '';
     foreach $curve (@curves) {      for (my $i = 0;$i<=$#curves;$i++) {
    $curve = $curves[$i];
    $gnuplot_input.= ', ' if ($i > 0);
  if (exists($curve->{'function'})) {   if (exists($curve->{'function'})) {
     $gnuplot_input.= $curve->{'function'}.' with '.$curve->{'linestyle'};      $gnuplot_input.= 
    $curve->{'function'}.' title "'.
    $curve->{'name'}.'" with '.
    $curve->{'linestyle'};
  } elsif (exists($curve->{'data'})) {   } elsif (exists($curve->{'data'})) {
     $gnuplot_input.= '\'-\' with '.$curve->{'linestyle'};      $gnuplot_input.= '\'-\' title "'.
    $curve->{'name'}.'" with '.
    $curve->{'linestyle'};
     my @Data = @{$curve->{'data'}};      my @Data = @{$curve->{'data'}};
     for ($i =0; $i<=$#Data; $i++) {      my @Data0 = @{$Data[0]};
       for (my $i =0; $i<=$#Data0; $i++) {
  foreach $dataset (@Data) {   foreach $dataset (@Data) {
     $datatext .= $dataset[$i] . ' ';      $datatext .= $dataset->[$i] . ' ';
  }   }
  $datatext .='\n';   $datatext .= $/;
     }      }
     $datatext .='\n';      $datatext .=$/;
  }   }
     }      }
     $gnuplot_input .= $datatext;      $gnuplot_input .= $/.$datatext;
     print $fh $gnuplot_input;      print $fh $gnuplot_input;
 }  }
   

Removed from v.1.8  
changed lines
  Added in v.1.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>