# HG changeset patch # User jwe # Date 1171586620 0 # Node ID 7cbf27ad6c3fefd507960efbe1258c679fdecd41 # Parent 8232ed4a7fc018e698ce790da1c42ba89e09ed77 [project @ 2007-02-16 00:43:40 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,14 @@ +2007-02-15 John W. Eaton + + * 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 * image/imshow.m: Don't restore old colormap. diff --git a/scripts/plot/__uiobject_axes_init__.in b/scripts/plot/__uiobject_axes_init__.in --- a/scripts/plot/__uiobject_axes_init__.in +++ b/scripts/plot/__uiobject_axes_init__.in @@ -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"; diff --git a/scripts/plot/__uiobject_axes_setr__.m b/scripts/plot/__uiobject_axes_setr__.m --- a/scripts/plot/__uiobject_axes_setr__.m +++ b/scripts/plot/__uiobject_axes_setr__.m @@ -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"} diff --git a/scripts/plot/__uiobject_draw_axes__.m b/scripts/plot/__uiobject_draw_axes__.m --- a/scripts/plot/__uiobject_draw_axes__.m +++ b/scripts/plot/__uiobject_draw_axes__.m @@ -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}, diff --git a/scripts/plot/newplot.m b/scripts/plot/newplot.m --- a/scripts/plot/newplot.m +++ b/scripts/plot/newplot.m @@ -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