Mercurial > hg > octave-lyh
changeset 14385:310039bc3dd3
box.m: Allow specification of a graphics axis to act on (bug #35486).
* box.m: Allow extra input argument of a graphics axis to act on.
Update docstring.
author | Garrett G Euler <ggeuler@gmail.com> |
---|---|
date | Sat, 18 Feb 2012 11:59:21 -0800 |
parents | 4e8f1d1b0d75 |
children | 59aab666f2bf |
files | scripts/plot/box.m |
diffstat | 1 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/box.m +++ b/scripts/plot/box.m @@ -17,11 +17,16 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {} box (@var{arg}) -## @deftypefnx {Function File} {} box (@var{h}, @dots{}) +## @deftypefn {Function File} {} box +## @deftypefnx {Function File} {} box ("on") +## @deftypefnx {Function File} {} box ("off") +## @deftypefnx {Function File} {} box (@var{hax}, @dots{}) ## Control the display of a border around the plot. ## The argument may be either @code{"on"} or @code{"off"}. If it is ## omitted, the current box state is toggled. +## +## If the first argument is an axis handle, @var{hax}, operate on the +## specified axis object. ## @seealso{grid} ## @end deftypefn @@ -29,14 +34,11 @@ function box (varargin) - h = gca (); - - box_state = get (h, "box"); - - nargs = numel (varargin); + [ax, varargin, nargs] = __plt_get_axis_arg__ ("box", varargin{:}); if (nargs == 0) - if (strcmpi (box_state, "on")) + box_state = get (ax, "box"); + if (strcmp (box_state, "on")) box_state = "off"; else box_state = "on"; @@ -49,13 +51,15 @@ elseif (strcmpi (state, "on")) box_state = "on"; else - print_usage (); + error ('box: argument must be "on" or "off"'); endif + else + error ('box: argument must be "on" or "off"'); endif else print_usage (); endif - set (h, "box", box_state); + set (ax, "box", box_state); endfunction