Mercurial > octave-nkf
changeset 20436:905fc6b85b4c
build: Consolidate __errcomm__.m and __errplot__.m to one file.
* __errplot__.m: Incorporate __errcomm__ into file as __errplot__().
Rename existing __errplot__ to __do_errplot__.
* scripts/plot/draw/private/__errcomm__.m: Delete file.
* scripts/plot/draw/module.mk: Remove __errcomm__.m from build system.
* errorbar.m, loglogerr.m, semilogxerr.m, semilogyerr.m: Call __errplot__
instead of __errcomm__.
* __pltopt__.m: Check for __do_errplot__ caller rather than __errplot__.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 26 Jul 2015 21:29:44 -0700 |
parents | 755ba248fb4a |
children | be6720faab96 |
files | scripts/plot/draw/errorbar.m scripts/plot/draw/loglogerr.m scripts/plot/draw/module.mk scripts/plot/draw/private/__errcomm__.m scripts/plot/draw/private/__errplot__.m scripts/plot/draw/semilogxerr.m scripts/plot/draw/semilogyerr.m scripts/plot/util/__pltopt__.m |
diffstat | 8 files changed, 61 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/draw/errorbar.m Sun Jul 26 18:33:57 2015 -0700 +++ b/scripts/plot/draw/errorbar.m Sun Jul 26 21:29:44 2015 -0700 @@ -178,7 +178,7 @@ unwind_protect hax = newplot (hax); - htmp = __errcomm__ ("errorbar", hax, varargin{:}); + htmp = __errplot__ ("errorbar", hax, varargin{:}); unwind_protect_cleanup if (! isempty (oldfig)) set (0, "currentfigure", oldfig);
--- a/scripts/plot/draw/loglogerr.m Sun Jul 26 18:33:57 2015 -0700 +++ b/scripts/plot/draw/loglogerr.m Sun Jul 26 21:29:44 2015 -0700 @@ -66,7 +66,7 @@ if (! ishold (hax)) set (hax, "xminortick", "on", "yminortick", "on"); endif - htmp = __errcomm__ ("loglogerr", hax, varargin{:}); + htmp = __errplot__ ("loglogerr", hax, varargin{:}); unwind_protect_cleanup if (! isempty (oldfig))
--- a/scripts/plot/draw/module.mk Sun Jul 26 18:33:57 2015 -0700 +++ b/scripts/plot/draw/module.mk Sun Jul 26 21:29:44 2015 -0700 @@ -6,7 +6,6 @@ scripts/plot/draw/private/__add_datasource__.m \ scripts/plot/draw/private/__bar__.m \ scripts/plot/draw/private/__contour__.m \ - scripts/plot/draw/private/__errcomm__.m \ scripts/plot/draw/private/__errplot__.m \ scripts/plot/draw/private/__ezplot__.m \ scripts/plot/draw/private/__interp_cube__.m \
--- a/scripts/plot/draw/private/__errcomm__.m Sun Jul 26 18:33:57 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -## Copyright (C) 2001-2015 Teemu Ikonen -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {} __errcomm__ (@var{caller}, @var{hax}, @dots{}) -## Undocumented internal function. -## @end deftypefn - -## Created: 20.02.2001 -## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> -## Keywords: errorbar, plotting - -function retval = __errcomm__ (caller, hax, varargin) - - if (nargin < 4) - print_usage (caller); - endif - - retval = []; - data = cell (6,1); - nargs = numel (varargin); - k = 1; - while (k <= nargs) - arg = varargin{k++}; - if (! isnumeric (arg)) - error ("%s: data argument %d must be numeric", caller, k-1); - endif - if (isvector (arg)) - arg = arg(:); - endif - sz = size (arg); - ndata = 1; - data{ndata} = arg; - while (k <= nargs) - arg = varargin{k++}; - if (ischar (arg) || iscellstr (arg)) - retval(end+1,1) = __errplot__(arg, hax, data{1:ndata}); - break; - endif - if (! isnumeric (arg)) - error ("%s: data argument %d must be numeric", caller, k-1); - endif - if (isvector (arg)) - arg = arg(:); - endif - if (! isscalar (arg) && ((isvector (arg) && numel (arg) != prod (sz)) - || any (size (arg) != sz))) - error ("%s: size of argument %d does not match others", caller, k-1); - endif - data{++ndata} = arg; - if (ndata > 6) - error ("%s: too many arguments to plot", caller); - endif - endwhile - endwhile - - ## No format code found, use yerrorbar - if (! (ischar (arg) || iscellstr (arg))) - retval = [retval; __errplot__("~", hax, data{1:ndata})]; - endif - - drawnow (); - -endfunction -
--- a/scripts/plot/draw/private/__errplot__.m Sun Jul 26 18:33:57 2015 -0700 +++ b/scripts/plot/draw/private/__errplot__.m Sun Jul 26 21:29:44 2015 -0700 @@ -24,10 +24,62 @@ ## Created: 18.7.2000 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> ## Keywords: errorbar, plotting +function retval = __errplot__ (caller, hax, varargin) -function h = __errplot__ (fstr, hax, varargin) + if (nargin < 4) + print_usage (caller); + endif - fmt = __pltopt__ ("__errplot__", fstr); + retval = []; + data = cell (6,1); + nargs = numel (varargin); + k = 1; + while (k <= nargs) + arg = varargin{k++}; + if (! isnumeric (arg)) + error ("%s: data argument %d must be numeric", caller, k-1); + endif + if (isvector (arg)) + arg = arg(:); + endif + sz = size (arg); + ndata = 1; + data{ndata} = arg; + while (k <= nargs) + arg = varargin{k++}; + if (ischar (arg) || iscellstr (arg)) + retval(end+1,1) = __do_errplot__(arg, hax, data{1:ndata}); + break; + endif + if (! isnumeric (arg)) + error ("%s: data argument %d must be numeric", caller, k-1); + endif + if (isvector (arg)) + arg = arg(:); + endif + if (! isscalar (arg) && ((isvector (arg) && numel (arg) != prod (sz)) + || any (size (arg) != sz))) + error ("%s: size of argument %d does not match others", caller, k-1); + endif + data{++ndata} = arg; + if (ndata > 6) + error ("%s: too many arguments to plot", caller); + endif + endwhile + endwhile + + ## No format code found, use yerrorbar + if (! (ischar (arg) || iscellstr (arg))) + retval = [retval; __do_errplot__("~", hax, data{1:ndata})]; + endif + + drawnow (); + +endfunction + +function h = __do_errplot__ (fstr, hax, varargin) + + fmt = __pltopt__ ("__do_errplot__", fstr); ## Set the plot type based on linestyle. switch (fmt.errorstyle) @@ -66,7 +118,7 @@ ## Must occur after __next_line_color__ in order to work correctly. hg = hggroup ("parent", hax); h = [h; hg]; - args = __add_datasource__ ("__errplot__", hg, + args = __add_datasource__ ("__do_errplot__", hg, {"x", "y", "l", "u", "xl", "xu"}); hl = [(__line__ (hg, "color", lc, "linestyle", "-", "marker", "none")),
--- a/scripts/plot/draw/semilogxerr.m Sun Jul 26 18:33:57 2015 -0700 +++ b/scripts/plot/draw/semilogxerr.m Sun Jul 26 21:29:44 2015 -0700 @@ -69,7 +69,7 @@ set (hax, "xminortick", "on"); endif - htmp = __errcomm__ ("semilogxerr", hax, varargin{:}); + htmp = __errplot__ ("semilogxerr", hax, varargin{:}); unwind_protect_cleanup if (! isempty (oldfig))
--- a/scripts/plot/draw/semilogyerr.m Sun Jul 26 18:33:57 2015 -0700 +++ b/scripts/plot/draw/semilogyerr.m Sun Jul 26 21:29:44 2015 -0700 @@ -69,7 +69,7 @@ set (hax, "yminortick", "on"); endif - htmp = __errcomm__ ("semilogyerr", hax, varargin{:}); + htmp = __errplot__ ("semilogyerr", hax, varargin{:}); unwind_protect_cleanup if (! isempty (oldfig))
--- a/scripts/plot/util/__pltopt__.m Sun Jul 26 18:33:57 2015 -0700 +++ b/scripts/plot/util/__pltopt__.m Sun Jul 26 21:29:44 2015 -0700 @@ -126,7 +126,7 @@ have_marker = false; ## If called by __errplot__, extract the linestyle before proceeding. - if (strcmp (caller, "__errplot__")) + if (strcmp (caller, "__do_errplot__")) if (strncmp (opt, "#~>", 3)) n = 3; elseif (strncmp (opt, "#~", 2) || strncmp (opt, "~>", 2)) @@ -258,7 +258,7 @@ %! assert (opts.linestyle, []); %! assert (opts.marker, []); %!test -%! opts = __pltopt__ ("__errplot__", "~>r"); +%! opts = __pltopt__ ("__do_errplot__", "~>r"); %! assert (opts.errorstyle, "~>"); %! assert (opts.color, [1 0 0 ]); %! assert (opts.linestyle, []);