Mercurial > hg > octave-terminal
changeset 8557:ab82e19002c4
better compatibility for axis label properties
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 21 Jan 2009 14:30:41 -0500 |
parents | d81caf2e3a28 |
children | 438520011621 |
files | scripts/ChangeLog scripts/plot/__axis_label__.m scripts/plot/title.m scripts/plot/ylabel.m src/ChangeLog src/graphics.cc |
diffstat | 6 files changed, 33 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,10 @@ 2009-01-21 John W. Eaton <jwe@octave.org> + * 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.
--- 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
--- 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
--- 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);
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-01-21 John W. Eaton <jwe@octave.org> + + * graphics.cc (properties::init): Set default xlabel, ylabel, + zlabel, and title properties that differ from default text + properties. + 2009-01-21 Jaroslav Hajek <highegg@gmail.com> * OPERATORS/op-range.cc: Define & register range-scalar ops.
--- 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 ()); }