Mercurial > hg > octave-lyh
changeset 17046:33444116aa77
semilogy.m: Overhaul function to use new __plt_get_axis_arg__.
* scripts/plot/semilogy.m: Use hax instead of h. Save figure instead of axes.
Check ishold status before setting yminortick.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Jul 2013 23:12:46 -0700 |
parents | 6dec8dbf8a97 |
children | 4f5c70792bd6 |
files | scripts/plot/semilogy.m |
diffstat | 1 files changed, 12 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/semilogy.m +++ b/scripts/plot/semilogy.m @@ -33,32 +33,33 @@ ## Author: jwe -function retval = semilogy (varargin) +function h = semilogy (varargin) - [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", varargin{:}); + [hax, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", 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, "yscale", "log"); - if (any (strcmp (get (gca, "nextplot"), {"new", "replace"}))) - set (h, "yminortick", "on"); + set (hax, "yscale", "log"); + if (! ishold (hax)) + set (hax, "yminortick", "on"); endif - tmp = __plt__ ("semilogy", h, varargin{:}); + htmp = __plt__ ("semilogy", hax, varargin{:}); if (nargout > 0) - retval = tmp; + h = htmp; endif unwind_protect_cleanup - axes (oldh); + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif end_unwind_protect endfunction