changeset 6173:dae08571782e

[project @ 2006-11-16 17:26:26 by jwe]
author jwe
date Thu, 16 Nov 2006 17:26:26 +0000
parents 2de853a110df
children d3c599afc455
files scripts/ChangeLog scripts/plot/__render_plot__.m
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2006-11-16  John W. Eaton  <jwe@octave.org>
+
+	* plot/__render_plot__.m: Check for mix of 2-d and 3-d plots
+	before sending anything to the plotter.
+
 2006-11-15  John W. Eaton  <jwe@octave.org>
 
 	* image/__img_gnuplot__.m: Store more info in global plot
--- a/scripts/plot/__render_plot__.m
+++ b/scripts/plot/__render_plot__.m
@@ -27,19 +27,30 @@
 
   if (! isempty (__plot_data__{cf}{mxi,myi}))
 
-    if (__multiplot_mode__(cf))
-      __gnuplot_raw__ ("clear\n");
-    endif
-
     have_image = false;
 
     for j = 1:length (__plot_data__{cf}{mxi,myi})
       if (__plot_data_type__{cf}{mxi,myi}(j) == 1)
 	have_image = true;
-	break;
+      endif
+      ## Do this check before sending any commands to gnuplot so that if
+      ## there is an error, we don't leave things in a bad state.
+      if (j == 1)
+	first_plot_data_type = __plot_data_type__{cf}{mxi,myi}(j);
+	this_plot_data_type = first_plot_data_type;
+      else
+	this_plot_data_type = __plot_data_type__{cf}{mxi,myi}(j);
+	if ((first_plot_data_type != 3 && this_plot_data_type == 3)
+	    || (first_plot_data_type == 3 && this_plot_data_type != 3))
+	  error ("can't mix 2-d and 3-d data in the same plot");
+	endif
       endif
     endfor
 
+    if (__multiplot_mode__(cf))
+      __gnuplot_raw__ ("clear\n");
+    endif
+
     if (have_image)
       __gnuplot_raw__ ("set size ratio -1;\n");
 
@@ -64,16 +75,7 @@
 
     for j = 1:length (__plot_data__{cf}{mxi,myi})
 
-      if (j == 1)
-	first_plot_data_type = __plot_data_type__{cf}{mxi,myi}(j);
-	this_plot_data_type = first_plot_data_type;
-      else
-	this_plot_data_type = __plot_data_type__{cf}{mxi,myi}(j);
-	if ((first_plot_data_type != 3 && this_plot_data_type == 3)
-	    || (first_plot_data_type == 3 && this_plot_data_type != 3))
-	  error ("can't mix 2-d and 3-d data in the same plot");
-	endif
-      endif
+      this_plot_data_type = __plot_data_type__{cf}{mxi,myi}(j);
 
       for i = 1:length (__plot_data__{cf}{mxi,myi}{j})