# HG changeset patch # User Rik # Date 1562792928 25200 # Node ID c90648dde5cf10269e2e2a77de67e4cef14979f9 # Parent 6eb32f0aea87d3aee9ebae2deeb3ddc391f43f92 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. diff -r 6eb32f0aea87 -r c90648dde5cf scripts/plot/appearance/text.m --- 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)