Mercurial > octave-nkf
changeset 17057:abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
* scripts/plot/semilogyerr.m, scripts/plot/semilogxerr.m,
scripts/plot/loglogerr.m: Update to use new __plt_get_axis_arg__.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Jul 2013 23:12:46 -0700 |
parents | 5dae8af4773d |
children | 95c6cada5067 |
files | scripts/plot/loglogerr.m scripts/plot/semilogxerr.m scripts/plot/semilogyerr.m |
diffstat | 3 files changed, 58 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/loglogerr.m Wed Jul 24 23:12:46 2013 -0700 +++ b/scripts/plot/loglogerr.m Wed Jul 24 23:12:46 2013 -0700 @@ -19,9 +19,11 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} loglogerr (@var{args}) ## @deftypefnx {Function File} {@var{h} =} loglogerr (@var{args}) -## Produce two-dimensional plots on double logarithm axis with -## errorbars. Many different combinations of arguments are possible. -## The most common form is +## Produce two-dimensional plots on a double logarithm axis with +## errorbars. +## +## Many different combinations of arguments are possible. The most common +## form is ## ## @example ## loglogerr (@var{x}, @var{y}, @var{ey}, @var{fmt}) @@ -30,7 +32,7 @@ ## @noindent ## which produces a double logarithm plot of @var{y} versus @var{x} ## with errors in the @var{y}-scale defined by @var{ey} and the plot -## format defined by @var{fmt}. See errorbar for available formats and +## format defined by @var{fmt}. See @code{errorbar} for available formats and ## additional information. ## @seealso{errorbar, semilogxerr, semilogyerr} ## @end deftypefn @@ -39,25 +41,25 @@ ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> ## Keywords: errorbar, plotting -function retval = loglogerr (varargin) +function h = loglogerr (varargin) - [h, varargin] = __plt_get_axis_arg__ ("loglogerr", varargin{:}); + [hax, varargin] = __plt_get_axis_arg__ ("loglogerr", varargin{:}); - oldh = gca (); + oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); unwind_protect - axes (h); - newplot (); + hax = newplot (hax); - set (h, "xscale", "log", "yscale", "log"); - - tmp = __errcomm__ ("loglogerr", h, varargin{:}); + set (hax, "xscale", "log", "yscale", "log"); + htmp = __errcomm__ ("loglogerr", hax, varargin{:}); + unwind_protect_cleanup + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif + end_unwind_protect - if (nargout > 0) - retval = tmp; - endif - unwind_protect_cleanup - axes (oldh); - end_unwind_protect + if (nargout > 0) + h = htmp; + endif endfunction
--- a/scripts/plot/semilogxerr.m Wed Jul 24 23:12:46 2013 -0700 +++ b/scripts/plot/semilogxerr.m Wed Jul 24 23:12:46 2013 -0700 @@ -20,8 +20,10 @@ ## @deftypefn {Function File} {} semilogxerr (@var{args}) ## @deftypefnx {Function File} {@var{h} =} semilogxerr (@var{args}) ## Produce two-dimensional plots using a logarithmic scale for the @var{x} -## axis and errorbars at each data point. Many different combinations of -## arguments are possible. The most common form is +## axis and errorbars at each data point. +## +## Many different combinations of arguments are possible. The most common +## form is ## ## @example ## semilogxerr (@var{x}, @var{y}, @var{ey}, @var{fmt}) @@ -32,32 +34,32 @@ ## with errors in the @var{y}-scale defined by @var{ey} and the plot ## format defined by @var{fmt}. See @code{errorbar} for available formats and ## additional information. -## @seealso{errorbar, loglogerr, semilogyerr} +## @seealso{errorbar, semilogyerr, loglogerr} ## @end deftypefn ## Created: 20.2.2001 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> ## Keywords: errorbar, plotting -function retval = semilogxerr (varargin) +function h = semilogxerr (varargin) - [h, varargin] = __plt_get_axis_arg__ ("semilogxerr", varargin{:}); + [hax, varargin] = __plt_get_axis_arg__ ("semilogxerr", varargin{:}); - oldh = gca (); + oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); unwind_protect - axes (h); - newplot (); + hax = newplot (hax); - set (h, "xscale", "log"); - - tmp = __errcomm__ ("semilogxerr", h, varargin{:}); + set (hax, "xscale", "log"); + htmp = __errcomm__ ("semilogxerr", hax, varargin{:}); + unwind_protect_cleanup + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif + end_unwind_protect - if (nargout > 0) - retval = tmp; - endif - unwind_protect_cleanup - axes (oldh); - end_unwind_protect + if (nargout > 0) + h = htmp; + endif endfunction
--- a/scripts/plot/semilogyerr.m Wed Jul 24 23:12:46 2013 -0700 +++ b/scripts/plot/semilogyerr.m Wed Jul 24 23:12:46 2013 -0700 @@ -20,8 +20,10 @@ ## @deftypefn {Function File} {} semilogyerr (@var{args}) ## @deftypefnx {Function File} {@var{h} =} semilogyerr (@var{args}) ## Produce two-dimensional plots using a logarithmic scale for the @var{y} -## axis and errorbars at each data point. Many different combinations of -## arguments are possible. The most common form is +## axis and errorbars at each data point. +## +## Many different combinations of arguments are possible. The most common +## form is ## ## @example ## semilogyerr (@var{x}, @var{y}, @var{ey}, @var{fmt}) @@ -32,32 +34,32 @@ ## with errors in the @var{y}-scale defined by @var{ey} and the plot ## format defined by @var{fmt}. See @code{errorbar} for available formats and ## additional information. -## @seealso{errorbar, loglogerr, semilogxerr} +## @seealso{errorbar, semilogxerr, loglogerr} ## @end deftypefn ## Created: 20.2.2001 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> ## Keywords: errorbar, plotting -function retval = semilogyerr (varargin) +function h = semilogyerr (varargin) - [h, varargin] = __plt_get_axis_arg__ ("semilogyerr", varargin{:}); + [hax, varargin] = __plt_get_axis_arg__ ("semilogyerr", varargin{:}); - oldh = gca (); + oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); unwind_protect - axes (h); - newplot (); + hax = newplot (hax); - set (h, "yscale", "log"); - - tmp = __errcomm__ ("semilogyerr", h, varargin{:}); + set (hax, "yscale", "log"); + htmp = __errcomm__ ("semilogyerr", hax, varargin{:}); + unwind_protect_cleanup + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif + end_unwind_protect - if (nargout > 0) - retval = tmp; - endif - unwind_protect_cleanup - axes (oldh); - end_unwind_protect + if (nargout > 0) + h = htmp; + endif endfunction