Mercurial > hg > octave-nkf
diff scripts/plot/__plt_get_axis_arg__.m @ 17125:b5d6314314fc
Change various plot functions to take advantage of new isaxes() function.
* scripts/geometry/voronoi.m, scripts/image/imagesc.m,
scripts/plot/__plt_get_axis_arg__.m, scripts/plot/axes.m, scripts/plot/cla.m,
scripts/plot/colorbar.m, scripts/plot/hold.m, scripts/plot/legend.m,
scripts/plot/plotmatrix.m, scripts/plot/plotyy.m,
scripts/plot/private/__errplot__.m, scripts/plot/private/__plt__.m,
scripts/plot/view.m: Use new isaxes function to simplify code.
* scripts/plot/shading.m: Use Octave convention for spacing of parentheses.
* scripts/plot/zlabel.m: Correct %!test incorrectly calling plot3 with figure
handle.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 31 Jul 2013 16:27:49 -0700 |
parents | 08dd9458684a |
children |
line wrap: on
line diff
--- a/scripts/plot/__plt_get_axis_arg__.m +++ b/scripts/plot/__plt_get_axis_arg__.m @@ -28,24 +28,24 @@ h = []; parent = find (strcmpi (varargin, "parent"), 1); - ## Look for numeric scalar which is a graphics handle but not the + + ## Look for a scalar which is a graphics handle but not the ## Root Figure (0) or an ordinary figure (integer). - if (numel (varargin) > 0 && isnumeric (varargin{1}) - && isscalar (varargin{1}) && ishandle (varargin{1}) - && varargin{1} != 0 && ! isfigure (varargin{1})) + if (numel (varargin) > 0 && numel (varargin{1}) == 1 + && ishandle (varargin{1}) && varargin{1} != 0 && ! isfigure (varargin{1})) htmp = varargin{1}; - obj = get (htmp); - if (strcmp (obj.type, "axes") && ! strcmp (obj.tag, "legend")) + if (! isaxes (htmp)) + error ("%s: expecting first argument to be axes handle", caller); + endif + if (! strcmp (get (htmp, "tag"), "legend")) h = htmp; varargin(1) = []; - else - error ("%s: expecting first argument to be axes handle", caller); endif + ## Look for "parent"/axis prop/value pair elseif (numel (varargin) > 1 && ! isempty (parent)) if (parent < numel (varargin) && ishandle (varargin{parent+1})) htmp = varargin{parent+1}; - obj = get (htmp); - if (strcmp (obj.type, "axes") && ! strcmp (obj.tag, "legend")) + if (isaxes (htmp) && ! strcmp (get (htmp, "tag"), "legend")) h = htmp; varargin(parent:parent+1) = []; else