# HG changeset patch # User John W. Eaton # Date 1232566241 18000 # Node ID ab82e19002c4f7127e805fcc7eb62006bc331259 # Parent d81caf2e3a2887f5c209ad32c95a28267b20eed8 better compatibility for axis label properties diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,10 @@ 2009-01-21 John W. Eaton + * plot/__axis_label__.m: Set properties in existing axis label + object instead of creating a new text object. + * plot/ylabel.m: Don't set rotation property here. + * plot/title.m: Don't set horizontalalignment property here. + * plot/ylabel.m: Insert rotation property in varargin before passing it on to __axis_label__. * plot/__axis_label__.m: Don't set rotation for ylabel here. diff --git a/scripts/plot/__axis_label__.m b/scripts/plot/__axis_label__.m --- a/scripts/plot/__axis_label__.m +++ b/scripts/plot/__axis_label__.m @@ -23,16 +23,18 @@ function retval = __axis_label__ (caller, txt, varargin) if (ischar (txt)) - ## FIXME -- should be able to use text instead of __go_text__. ca = gca (); - h = __go_text__ (ca, "fontangle", get (ca, "fontangle"), - "fontname", get (ca, "fontname"), - "fontsize", get (ca, "fontsize"), - "fontunits", get (ca, "fontunits"), - "fontweight", get (ca, "fontweight"), - "string", txt, varargin{:}); - set (ca, caller, h); + h = get (gca (), caller); + + set (h, "fontangle", get (ca, "fontangle"), + "fontname", get (ca, "fontname"), + "fontsize", get (ca, "fontsize"), + "fontunits", get (ca, "fontunits"), + "fontweight", get (ca, "fontweight"), + "string", txt, + varargin{:}); + if (nargout > 0) retval = h; endif diff --git a/scripts/plot/title.m b/scripts/plot/title.m --- a/scripts/plot/title.m +++ b/scripts/plot/title.m @@ -30,7 +30,6 @@ function h = title (s, varargin) if (rem (nargin, 2) == 1) - varargin = [{"horizontalalignment", "center"}, varargin]; if (nargout > 0) h = __axis_label__ ("title", s, varargin{:}); else diff --git a/scripts/plot/ylabel.m b/scripts/plot/ylabel.m --- a/scripts/plot/ylabel.m +++ b/scripts/plot/ylabel.m @@ -38,7 +38,6 @@ oldh = gca (); unwind_protect axes (h); - varargin = {varargin{1}, "rotation", 90, varargin{2:end}}; tmp = __axis_label__ ("ylabel", varargin{:}); unwind_protect_cleanup axes (oldh); diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-01-21 John W. Eaton + + * graphics.cc (properties::init): Set default xlabel, ylabel, + zlabel, and title properties that differ from default text + properties. + 2009-01-21 Jaroslav Hajek * OPERATORS/op-range.cc: Define & register range-scalar ops. diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -2208,6 +2208,7 @@ tightinset.add_constraint (dim_vector (1, 4)); x_zlim.resize (1, 2); + sx = "linear"; sy = "linear"; sz = "linear"; @@ -2215,13 +2216,22 @@ xset (xlabel.handle_value (), "handlevisibility", "off"); xset (ylabel.handle_value (), "handlevisibility", "off"); xset (zlabel.handle_value (), "handlevisibility", "off"); - xset (title.handle_value (), "handlevisibility", "off"); + xset (xlabel.handle_value (), "horizontalalignment", "center"); + xset (ylabel.handle_value (), "horizontalalignment", "center"); + xset (zlabel.handle_value (), "horizontalalignment", "right"); + xset (title.handle_value (), "horizontalalignment", "center"); + + xset (xlabel.handle_value (), "verticalalignment", "cap"); + xset (ylabel.handle_value (), "verticalalignment", "bottom"); + xset (title.handle_value (), "verticalalignment", "bottom"); + + xset (ylabel.handle_value (), "rotation", 90.0); + adopt (xlabel.handle_value ()); adopt (ylabel.handle_value ()); adopt (zlabel.handle_value ()); - adopt (title.handle_value ()); }