Mercurial > octave
changeset 27227:c90648dde5cf
text.m: Allow axes handle as first argument (bug #56513).
* text.m: Add new calling form to docstring. Move call to __plt_get_axis_arg__
to start of function.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 10 Jul 2019 14:08:48 -0700 |
parents | 6eb32f0aea87 |
children | c80681b4948d |
files | scripts/plot/appearance/text.m |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/appearance/text.m Wed Jul 10 13:48:01 2019 -0700 +++ b/scripts/plot/appearance/text.m Wed Jul 10 14:08:48 2019 -0700 @@ -20,6 +20,7 @@ ## @deftypefn {} {} text (@var{x}, @var{y}, @var{string}) ## @deftypefnx {} {} text (@var{x}, @var{y}, @var{z}, @var{string}) ## @deftypefnx {} {} text (@dots{}, @var{prop}, @var{val}, @dots{}) +## @deftypefnx {} {} text (@var{hax}, @dots{}) ## @deftypefnx {} {@var{h} =} text (@dots{}) ## Create a text object with text @var{string} at position @var{x}, @var{y}, ## (@var{z}) on the current axes. @@ -31,6 +32,9 @@ ## Optional property/value pairs may be used to control the appearance of the ## text. ## +## If the first argument @var{hax} is an axes handle, then add text to this +## axes, rather than the current axes returned by @code{gca}. +## ## The optional return value @var{h} is a vector of graphics handles to the ## created text objects. ## @@ -46,6 +50,8 @@ function h = text (varargin) + [hax, varargin, nargin] = __plt_get_axis_arg__ ("text", varargin{:}); + nargs = nargin; offset = 0; @@ -82,9 +88,6 @@ print_usage (); endif - ## Get axis argument which may be in a "parent" PROP/VAL pair - [hax, varargin] = __plt_get_axis_arg__ ("text", varargin{:}); - ## String argument may be in PROP/VAL pair idx = find (strcmpi (varargin, "string"), 1); if (idx)