Mercurial > hg > octave-lyh
diff scripts/plot/loglog.m @ 17047:4f5c70792bd6
loglog.m: Overhaul function to use new __plt_get_axis_arg__.
* scripts/plot/loglog.m: Use hax instead of h. Save figure instead of axes.
Check ishold status before setting minortick.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Jul 2013 23:12:46 -0700 |
parents | 460a3c6d8bf1 |
children | eaab03308c0b |
line wrap: on
line diff
--- a/scripts/plot/loglog.m +++ b/scripts/plot/loglog.m @@ -33,33 +33,35 @@ ## Author: jwe -function retval = loglog (varargin) +function h = loglog (varargin) - [h, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:}); + [hax, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:}); if (nargs < 1) print_usage (); endif - oldh = gca (); + oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); unwind_protect - axes (h); - newplot (); + hax = newplot (hax); - set (h, "xscale", "log", "yscale", "log"); - if (any( strcmp (get (gca, "nextplot"), {"new", "replace"}))) - set (h, "xminortick", "on", "yminortick", "on"); + set (hax, "xscale", "log", "yscale", "log"); + if (! ishold (hax)) + set (hax, "xminortick", "on", "yminortick", "on"); endif - tmp = __plt__ ("loglog", h, varargin{:}); + htmp = __plt__ ("loglog", hax, varargin{:}); - if (nargout > 0) - retval = tmp; + unwind_protect_cleanup + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); endif - unwind_protect_cleanup - axes (oldh); end_unwind_protect + if (nargout > 0) + h = htmp; + endif + endfunction