changeset 2523:007e977442b8

[project @ 1996-11-16 00:33:22 by jwe]
author jwe
date Sat, 16 Nov 1996 00:33:24 +0000
parents 4f095783ee43
children 7dc71ca5d092
files scripts/ChangeLog scripts/plot/__plt__.m src/ChangeLog src/pt-plot.cc
diffstat 4 files changed, 54 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Nov 15 20:01:21 1996 +0000
+++ b/scripts/ChangeLog	Sat Nov 16 00:33:24 1996 +0000
@@ -1,3 +1,8 @@
+Fri Nov 15 18:13:00 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* plot/__plt__.m: Add explicit replot after last command is
+	issued, to force all lines to be displayed.  Hmm.
+
 Thu Nov 14 00:06:34 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* plot/axis.m, plot/bottom_title.m, plot/contour.m,
--- a/scripts/plot/__plt__.m	Fri Nov 15 20:01:21 1996 +0000
+++ b/scripts/plot/__plt__.m	Sat Nov 16 00:33:24 1996 +0000
@@ -28,7 +28,7 @@
   elseif (nargin > 2)
 
     first_plot = 1;
-    hold_state = ishold;
+    hold_state = ishold ();
 
     unwind_protect
 
@@ -84,6 +84,12 @@
 	endif
       endif
 
+      ## Something fishy is going on.  I don't think this should be
+      ## necessary, but without it, sometimes not all the lines from a
+      ## given plot command appear on the screen.
+
+      replot;
+
     unwind_protect_cleanup
 
       if (! hold_state)
--- a/src/ChangeLog	Fri Nov 15 20:01:21 1996 +0000
+++ b/src/ChangeLog	Sat Nov 16 00:33:24 1996 +0000
@@ -1,5 +1,7 @@
 Fri Nov 15 13:48:02 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* pt-plot.cc: Put semicolons at the ends of all plot commands.
+
 	* defaults.cc (subst_octave_home): Start subsequent searchs from
 	the end of the replaced text.
 
--- a/src/pt-plot.cc	Fri Nov 15 20:01:21 1996 +0000
+++ b/src/pt-plot.cc	Sat Nov 16 00:33:24 1996 +0000
@@ -102,28 +102,32 @@
 // Use shortest possible abbreviations to minimize trouble caused by
 // gnuplot's fixed-length command line buffer.
 
-#ifndef GNUPLOT_COMMAND_PLOT  
-#define GNUPLOT_COMMAND_PLOT   "pl"
+#ifndef GPLOT_CMD_PLOT  
+#define GPLOT_CMD_PLOT   "pl"
 #endif
 
-#ifndef GNUPLOT_COMMAND_REPLOT 
-#define GNUPLOT_COMMAND_REPLOT "rep"
+#ifndef GPLOT_CMD_REPLOT 
+#define GPLOT_CMD_REPLOT "rep"
+#endif
+
+#ifndef GPLOT_CMD_SPLOT 
+#define GPLOT_CMD_SPLOT  "sp"
 #endif
 
-#ifndef GNUPLOT_COMMAND_SPLOT 
-#define GNUPLOT_COMMAND_SPLOT  "sp"
+#ifndef GPLOT_CMD_USING
+#define GPLOT_CMD_USING  "u"
 #endif
 
-#ifndef GNUPLOT_COMMAND_USING
-#define GNUPLOT_COMMAND_USING  "u"
+#ifndef GPLOT_CMD_WITH 
+#define GPLOT_CMD_WITH   "w"
 #endif
 
-#ifndef GNUPLOT_COMMAND_WITH 
-#define GNUPLOT_COMMAND_WITH   "w"
+#ifndef GPLOT_CMD_TITLE
+#define GPLOT_CMD_TITLE  "t"
 #endif
 
-#ifndef GNUPLOT_COMMAND_TITLE
-#define GNUPLOT_COMMAND_TITLE  "t"
+#ifndef GPLOT_CMD_END
+#define GPLOT_CMD_END ";\n"
 #endif
 
 static void
@@ -199,7 +203,7 @@
       *plot_stream << "set data style lines\n";
 
       if (gnuplot_terminal_type)
-	*plot_stream << "set term " << gnuplot_terminal_type << "\n";
+	*plot_stream << "set term " << gnuplot_terminal_type << GPLOT_CMD_END;
     }
 }
 
@@ -214,13 +218,13 @@
 	return -1;
     }
 
-  int replot_len = strlen (GNUPLOT_COMMAND_REPLOT);
-  int splot_len = strlen (GNUPLOT_COMMAND_SPLOT);
-  int plot_len = strlen (GNUPLOT_COMMAND_PLOT);
+  int replot_len = strlen (GPLOT_CMD_REPLOT);
+  int splot_len = strlen (GPLOT_CMD_SPLOT);
+  int plot_len = strlen (GPLOT_CMD_PLOT);
 
-  bool is_replot = (strncmp (cmd, GNUPLOT_COMMAND_REPLOT, replot_len) == 0);
-  bool is_splot = (strncmp (cmd, GNUPLOT_COMMAND_SPLOT, splot_len) == 0);
-  bool is_plot = (strncmp (cmd, GNUPLOT_COMMAND_PLOT, plot_len) == 0);
+  bool is_replot = (strncmp (cmd, GPLOT_CMD_REPLOT, replot_len) == 0);
+  bool is_splot = (strncmp (cmd, GPLOT_CMD_SPLOT, splot_len) == 0);
+  bool is_plot = (strncmp (cmd, GPLOT_CMD_PLOT, plot_len) == 0);
 
   if (plot_line_count == 0 && is_replot)
     error ("replot: no previous plot");
@@ -231,7 +235,7 @@
       if (! (is_replot || is_splot || is_plot)
 	  && plot_line_count > 0
 	  && Vautomatic_replot)
-	*plot_stream << GNUPLOT_COMMAND_REPLOT << "\n";
+	*plot_stream << GPLOT_CMD_REPLOT << GPLOT_CMD_END;
 
       plot_stream->flush ();
     }
@@ -263,7 +267,7 @@
       if (plot_line_count == 0)
 	{
 	  if (plot_list)
-	    plot_buf << GNUPLOT_COMMAND_PLOT;
+	    plot_buf << GPLOT_CMD_PLOT;
 	  else
 	    {
 	      ::error ("replot: must have something to plot");
@@ -271,27 +275,27 @@
 	    }
 	}
       else
-	plot_buf << GNUPLOT_COMMAND_REPLOT;
+	plot_buf << GPLOT_CMD_REPLOT;
       break;
 
     case 2:
       if (clear_before_plotting || plot_line_count == 0)
 	{
 	  plot_line_count = 0;
-	  plot_buf << GNUPLOT_COMMAND_PLOT;
+	  plot_buf << GPLOT_CMD_PLOT;
 	}
       else
-	plot_buf << GNUPLOT_COMMAND_REPLOT;
+	plot_buf << GPLOT_CMD_REPLOT;
       break;
 
     case 3:
       if (clear_before_plotting || plot_line_count == 0)
 	{
 	  plot_line_count = 0;
-	  plot_buf << GNUPLOT_COMMAND_SPLOT;
+	  plot_buf << GPLOT_CMD_SPLOT;
 	}
       else
-	plot_buf << GNUPLOT_COMMAND_REPLOT;
+	plot_buf << GPLOT_CMD_REPLOT;
       break;
 
     default:
@@ -319,7 +323,7 @@
 	return;
     }
 
-  plot_buf << "\n" << ends;
+  plot_buf << GPLOT_CMD_END << ends;
 
   // Just testing...
   //  char *message = plot_buf.str ();
@@ -518,7 +522,7 @@
   for (int i = 0; i < qual_count; i++)
     {
       if (i == 0)
-	plot_buf << " " << GNUPLOT_COMMAND_USING << " ";
+	plot_buf << " " << GPLOT_CMD_USING << " ";
       else
 	plot_buf << ":";
 
@@ -545,7 +549,7 @@
 {
   if (! sp_style.empty ())
     {
-      plot_buf << " " << GNUPLOT_COMMAND_WITH << " " << sp_style;
+      plot_buf << " " << GPLOT_CMD_WITH << " " << sp_style;
 
       if (sp_linetype)
 	{
@@ -753,17 +757,17 @@
     {
       octave_value tmp = sp_title_clause->eval (false);
       if (! error_state && tmp.is_string ())
-	plot_buf << " " << GNUPLOT_COMMAND_TITLE << " "
+	plot_buf << " " << GPLOT_CMD_TITLE << " "
 	  << '"' << tmp.string_value () << '"';
       else
 	{
 	  warning ("line title must be a string");
-	  plot_buf << " " << GNUPLOT_COMMAND_TITLE << " "
+	  plot_buf << " " << GPLOT_CMD_TITLE << " "
 	    << '"' << "line " << plot_line_count << '"';
 	}
     }
   else
-    plot_buf << " " << GNUPLOT_COMMAND_TITLE << " "
+    plot_buf << " " << GPLOT_CMD_TITLE << " "
       << '"' << "line " << plot_line_count << '"';
 
   if (sp_style_clause)
@@ -892,7 +896,7 @@
   if (plot_stream && *plot_stream)
     {
       ostrstream plot_buf;
-      plot_buf << "cd \"" << newdir << "\"\n" << ends;
+      plot_buf << "cd \"" << newdir << "\"" GPLOT_CMD_END << ends;
       char *message = plot_buf.str ();
       send_to_plot_stream (message);
       delete [] message;
@@ -1015,7 +1019,7 @@
 	  ostrstream buf;
 	  for (int i = 2; i < argc; i++)
 	    buf << argv[i] << " ";
-	  buf << "\n" << ends;
+	  buf << GPLOT_CMD_END << ends;
 	  gnuplot_terminal_type = buf.str ();
 	}
     }
@@ -1023,7 +1027,7 @@
   for (int i = 0; i < argc; i++)
     plot_buf << argv[i] << " ";
 
-  plot_buf << "\n" << ends;
+  plot_buf << GPLOT_CMD_END << ends;
 
   char *plot_command = plot_buf.str ();
   send_to_plot_stream (plot_command);
@@ -1059,7 +1063,7 @@
   for (int i = 0; i < argc; i++)
     plot_buf << argv[i] << " ";
 
-  plot_buf << "\n" << ends;
+  plot_buf << GPLOT_CMD_END << ends;
 
   char *plot_command = plot_buf.str ();
   send_to_plot_stream (plot_command);