Mercurial > hg > octave-lyh
changeset 17043:f4dc32d6f263
semilogx.m: Overhaul function to use new __plt_get_axis_arg__.
* scripts/plot/semilogx.m: Use hax instead of h. Save figure instead of axes.
Check ishold status before setting xminortick.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Jul 2013 23:12:46 -0700 |
parents | 62d5f73e840c |
children | cec8c423b3e8 |
files | scripts/plot/semilogx.m |
diffstat | 1 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/semilogx.m +++ b/scripts/plot/semilogx.m @@ -33,33 +33,35 @@ ## Author: jwe -function retval = semilogx (varargin) +function h = semilogx (varargin) - [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogx", varargin{:}); + [hax, varargin, nargs] = __plt_get_axis_arg__ ("semilogx", 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"); - if (any( strcmp (get (gca, "nextplot"), {"new", "replace"}))) - set (h, "xminortick", "on"); + set (hax, "xscale", "log"); + if (! ishold (hax)) + set (hax, "xminortick", "on"); endif - tmp = __plt__ ("semilogx", h, varargin{:}); + htmp = __plt__ ("semilogx", 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