# HG changeset patch # User Rik # Date 1374732766 25200 # Node ID 33444116aa7754c41e976d888ce38aa0a6d7be82 # Parent 6dec8dbf8a970f96aa0e46c049062301bd7dcbe8 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. diff -r 6dec8dbf8a97 -r 33444116aa77 scripts/plot/semilogy.m --- a/scripts/plot/semilogy.m Wed Jul 24 23:12:46 2013 -0700 +++ b/scripts/plot/semilogy.m Wed Jul 24 23:12:46 2013 -0700 @@ -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