Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r884 - trunk/StandAlone


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r884 - trunk/StandAlone
  • Date: Thu, 2 Feb 2006 23:54:36 -0700 (MST)

Author: abe
Date: Thu Feb  2 23:54:35 2006
New Revision: 884

Modified:
   trunk/StandAlone/manta_scaling_plot.pl
Log:

Updates to scaling plots

M    StandAlone/manta_scaling_plot.pl


Modified: trunk/StandAlone/manta_scaling_plot.pl
==============================================================================
--- trunk/StandAlone/manta_scaling_plot.pl      (original)
+++ trunk/StandAlone/manta_scaling_plot.pl      Thu Feb  2 23:54:35 2006
@@ -6,6 +6,7 @@
 $outfile = "";
 $title = "";
 $use_errorbars = 0;
+$plot_linear = 1;
 
 sub usage {
 
@@ -20,6 +21,7 @@
         "-plottype <string> -- default minmaxavg\n".
         "-title <string>".
         "-errorbars       -- Display min and max with error bars\n".
+        "-nolinear        -- Don't plot linear for each series.\n" .
         "                 -- Specify a label for each series. (required)\n";
 }
 
@@ -32,15 +34,25 @@
 
     # Set the xtics.
     my @tics;
+    my $xmin =  999999;
+    my $xmax = -999999;
     for (my $p=0;$p<(@{$data[0]});++$p) {
         my $tic = $data[0][$p][0];
         push(@tics,"\"$tic\" ". $tic );
+
+        if ($tic < $xmin) {
+            $xmin = $tic;
+        }
+        if ($tic > $xmax) {
+            $xmax = $tic;
+        }
     }
     $plot = $plot . "set xtics (" . join( ", ", @tics ) . ")\n";
     
     # Set the x range of the plot.
-    my $xmax = ($data[0][($data[0][$p][0])-1][0]+8);
-    $plot = $plot . "set xrange [0:$xmax]\n";
+    my $range = ($xmax - $xmin);
+
+    $plot = $plot . "set xrange [0:($xmax+$range*0.1)]\n";
     $plot = $plot . "set yrange [0:]\n";
 
     # Begin the plot command.
@@ -57,25 +69,31 @@
 
         my $m = ($y1-$y0) / ($x1-$x0);
 
-
-        # Add labels for percent of linear at each point.
-        for (my $p=0;$p<(@{$data[$i]});++$p) {
-            my $x = $data[$i][$p][0];
-            my $y = $m*($x-$x0)+$y0;
-            my $percent_of_lin = 
sprintf("%2.0f",(($data[$i][$p][3]/$y)*100));
-            
-            $label = $label . "set label \"  $percent_of_lin%\" at 
$x,$data[$i][$p][3]\n";
-        }
-
         # Plot the actual data.
         $tmp_file = "$out_file.temp$i.txt";
         push(@plots, 
              #"\"$tmp_file\" using 1:2 title \"Min $labels[$i]\", " .
              #"\"$tmp_file\" using 1:3 title \"Max $labels[$i]\", " .
-             "\"$tmp_file\" using 1:4 title \"Avg $labels[$i]\" with linesp 
lt 2 lw 3, " .
-             "$m*(x-$x0)+$y0 notitle with lines 1"
+             "\"$tmp_file\" using 1:4 title \"Avg $labels[$i]\" with linesp 
lt 2 lw 3"
              );
 
+        # Check to see if linear scaling should be plotted also
+        if ($plot_linear) {
+
+            # Add labels for percent of linear at each point.
+            for (my $p=0;$p<(@{$data[$i]});++$p) {
+                my $x = $data[$i][$p][0];
+                my $y = $m*($x-$x0)+$y0;
+                my $percent_of_lin = 
sprintf("%2.0f",(($data[$i][$p][3]/$y)*100));
+                
+                $label = $label . "set label \" $percent_of_lin%\" at 
$x,$data[$i][$p][3]\n";
+            }
+
+            push(@plots, 
+                 "$m*(x-$x0)+$y0 notitle with lines 1"
+                 );
+        }
+
         # Check to see if we should use error bars.
         if ($use_errorbars) {
             push(@plots, 
@@ -87,7 +105,7 @@
     }
 
     $plot = "$plot\n$label\nplot " . join( ", ", @plots ) . "\n";
-    # print "PLOT: $plot\n";
+   print "PLOT: $plot\n";
 
     return $plot;
 }
@@ -122,6 +140,9 @@
     elsif ($ARGV[$i] eq "-errorbars") {
         $use_errorbars = 1;
     }
+    elsif ($ARGV[$i] eq "-nolinear") {
+        $plot_linear = 0;
+    }
 }
 
 # Check to see if enough subtitles were provided.
@@ -168,7 +189,7 @@
 while (<INPUT>) {
     $line = $_;
     
-    if ($line =~ /$key\s*([0-9]+)/) {
+    if ($line =~ /$key\s*([0-9\.]+)/) {
         $np = $1;
     }
 




  • [MANTA] r884 - trunk/StandAlone, abe, 02/02/2006

Archive powered by MHonArc 2.6.16.

Top of page