Mercurial > hg > octave-nkf
diff scripts/plot/gtext.m @ 13259:b6efe55f97c7
Allow gtext() to have multi-line text strings (Bug #33232)
* gtext.m: Simplify code to take advantage of cellstr handling already
available in text().
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Fri, 30 Sep 2011 09:57:10 -0700 |
parents | 6efa1a691713 |
children | 72c96de7a403 |
line wrap: on
line diff
--- a/scripts/plot/gtext.m +++ b/scripts/plot/gtext.m @@ -29,26 +29,19 @@ function gtext (s, varargin) - if (nargin > 0) - if (iscellstr (s)) - if (isempty (s)) - s = ""; - else - s = sprintf ("%s\n", s{:}); - endif - endif - if (ischar (s)) - if (! isempty (s)) - [x, y] = ginput (1); - text (x, y, s, varargin{:}); - endif - else - error ("gtext: expecting a string or cell array of strings"); - endif - else + if (nargin < 1) print_usage (); endif + if (! (ischar (s) || iscellstr (s))) + error ("gtext: S must be a string or cell array of strings"); + endif + + if (! isempty (s)) + [x, y] = ginput (1); + text (x, y, s, varargin{:}); + endif + endfunction ## Remove from test statistics. No real tests possible.