changeset 6314:7cbf27ad6c3f

[project @ 2007-02-16 00:43:40 by jwe]
author jwe
date Fri, 16 Feb 2007 00:43:40 +0000
parents 8232ed4a7fc0
children cf52583fe055
files scripts/ChangeLog scripts/plot/__uiobject_axes_init__.in scripts/plot/__uiobject_axes_setr__.m scripts/plot/__uiobject_draw_axes__.m scripts/plot/newplot.m
diffstat 5 files changed, 39 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Feb 15 22:56:13 2007 +0000
+++ b/scripts/ChangeLog	Fri Feb 16 00:43:40 2007 +0000
@@ -1,3 +1,14 @@
+2007-02-15  John W. Eaton  <jwe@octave.org>
+
+	* plot/__uiobject_axes_init__.in, plot/__uiobject_axes_setr__.m:
+	Delete title, xlabel, ylabel, and zlabel properties before
+	reassigning.
+	* plot/__uiobject_axes_init__.in: New arg, mode.
+	Don't init outerposition if "mode" is "replace".
+	* plot/newplot.m: Check both figure and axes nextplot properties.
+	If axes nextplot property is replace, pass "replace" as mode arg
+	to __uiobject_axes_init__.
+
 2007-02-15  Daniel J Sebald  <daniel.sebald@ieee.org>
 
 	* image/imshow.m: Don't restore old colormap.
--- a/scripts/plot/__uiobject_axes_init__.in	Thu Feb 15 22:56:13 2007 +0000
+++ b/scripts/plot/__uiobject_axes_init__.in	Fri Feb 16 00:43:40 2007 +0000
@@ -24,16 +24,23 @@
 
 ## Author: jwe
 
-function h = __uiobject_axes_init__ (h)
+function h = __uiobject_axes_init__ (h, mode)
 
   __uiobject_globals__;
 
   if (nargin == 1)
+    mode = "";
+  endif
+
+  if (nargin == 1 || nargin == 2)
 
     s = get (h);
 
     s.__setter__ = @__uiobject_axes_setr__;
 
+    if (isfield (s, "title") && ! isempty (s.title))
+      delete (s.title);
+    endif
     s.title = __uiobject_text_ctor__ (h);
 
     s.box = "on";
@@ -52,6 +59,15 @@
     s.ylimmode = "auto";
     s.zlimmode = "auto";
 
+    if (isfield (s, "xlabel") && ! isempty (s.xlabel))
+      delete (s.xlabel);
+    endif
+    if (isfield (s, "ylabel") && ! isempty (s.ylabel))
+      delete (s.ylabel);
+    endif
+    if (isfield (s, "zlabel") && ! isempty (s.zlabel))
+      delete (s.zlabel);
+    endif
     s.xlabel = __uiobject_text_ctor__ (h);
     s.ylabel = __uiobject_text_ctor__ (h);
     s.zlabel = __uiobject_text_ctor__ (h);
@@ -92,7 +108,12 @@
 
     s.nextplot = "replace";
 
-    s.outerposition = [0, 0, 1, 1];
+    ## FIXME -- this is not quite right; we should preserve "position"
+    ## and "units".
+    if (! isfield (s, "outerposition")
+        || (isempty (s.outerposition) || ! strcmp (mode, "replace")))
+      s.outerposition = [0, 0, 1, 1];
+    endif
 
     s.dataaspectratio = [];
     s.dataaspectratiomode = "auto";
--- a/scripts/plot/__uiobject_axes_setr__.m	Thu Feb 15 22:56:13 2007 +0000
+++ b/scripts/plot/__uiobject_axes_setr__.m	Fri Feb 16 00:43:40 2007 +0000
@@ -44,6 +44,7 @@
 	    endif
 	    switch (key)
 	      case {"title", "xlabel", "ylabel", "zlabel"}
+		delete (obj.(key));
 		val = __uiobject_text_ctor__ (h, "string", val);
 
 	      case {"xlim", "ylim", "zlim"}
--- a/scripts/plot/__uiobject_draw_axes__.m	Thu Feb 15 22:56:13 2007 +0000
+++ b/scripts/plot/__uiobject_draw_axes__.m	Fri Feb 16 00:43:40 2007 +0000
@@ -629,7 +629,7 @@
 	fprintf (plot_stream, "set view %g, %g;\n", rot_x, rot_z);
 
 	fprintf (plot_stream, "%s '-' %s %s %s", plot_cmd,
-		 usingclause{i}, titlespec{1}, withclause{1});
+		 usingclause{1}, titlespec{1}, withclause{1});
       endif
       for i = 2:data_idx
 	fprintf (plot_stream, ", '-' %s %s %s", usingclause{i},
--- a/scripts/plot/newplot.m	Thu Feb 15 22:56:13 2007 +0000
+++ b/scripts/plot/newplot.m	Fri Feb 16 00:43:40 2007 +0000
@@ -27,9 +27,10 @@
     cf = gcf ();
     fnp = get (cf, "nextplot");
     switch (fnp)
+      ## FIXME -- probably we should do more than validate the nextplot
+      ## property value...
       case "new"
       case "add"
-	return;
       case "replacechildren"
       case "replace"
       otherwise
@@ -42,7 +43,7 @@
       case "replacechildren"
       case "replace"
 	__next_line_color__ (true);
-	__uiobject_axes_init__ (ca);
+	__uiobject_axes_init__ (ca, "replace");
       otherwise
 	error ("newplot: unrecognized nextplot property for current axes");
     endswitch