Mercurial > octave-nkf
comparison scripts/plot/draw/private/__errplot__.m @ 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 | 9fc020886ae9 |
children | d8535ec99c86 |
comparison
equal
deleted
inserted
replaced
20435:755ba248fb4a | 20436:905fc6b85b4c |
---|---|
22 ## @end deftypefn | 22 ## @end deftypefn |
23 | 23 |
24 ## Created: 18.7.2000 | 24 ## Created: 18.7.2000 |
25 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> | 25 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> |
26 ## Keywords: errorbar, plotting | 26 ## Keywords: errorbar, plotting |
27 | 27 function retval = __errplot__ (caller, hax, varargin) |
28 function h = __errplot__ (fstr, hax, varargin) | 28 |
29 | 29 if (nargin < 4) |
30 fmt = __pltopt__ ("__errplot__", fstr); | 30 print_usage (caller); |
31 endif | |
32 | |
33 retval = []; | |
34 data = cell (6,1); | |
35 nargs = numel (varargin); | |
36 k = 1; | |
37 while (k <= nargs) | |
38 arg = varargin{k++}; | |
39 if (! isnumeric (arg)) | |
40 error ("%s: data argument %d must be numeric", caller, k-1); | |
41 endif | |
42 if (isvector (arg)) | |
43 arg = arg(:); | |
44 endif | |
45 sz = size (arg); | |
46 ndata = 1; | |
47 data{ndata} = arg; | |
48 while (k <= nargs) | |
49 arg = varargin{k++}; | |
50 if (ischar (arg) || iscellstr (arg)) | |
51 retval(end+1,1) = __do_errplot__(arg, hax, data{1:ndata}); | |
52 break; | |
53 endif | |
54 if (! isnumeric (arg)) | |
55 error ("%s: data argument %d must be numeric", caller, k-1); | |
56 endif | |
57 if (isvector (arg)) | |
58 arg = arg(:); | |
59 endif | |
60 if (! isscalar (arg) && ((isvector (arg) && numel (arg) != prod (sz)) | |
61 || any (size (arg) != sz))) | |
62 error ("%s: size of argument %d does not match others", caller, k-1); | |
63 endif | |
64 data{++ndata} = arg; | |
65 if (ndata > 6) | |
66 error ("%s: too many arguments to plot", caller); | |
67 endif | |
68 endwhile | |
69 endwhile | |
70 | |
71 ## No format code found, use yerrorbar | |
72 if (! (ischar (arg) || iscellstr (arg))) | |
73 retval = [retval; __do_errplot__("~", hax, data{1:ndata})]; | |
74 endif | |
75 | |
76 drawnow (); | |
77 | |
78 endfunction | |
79 | |
80 function h = __do_errplot__ (fstr, hax, varargin) | |
81 | |
82 fmt = __pltopt__ ("__do_errplot__", fstr); | |
31 | 83 |
32 ## Set the plot type based on linestyle. | 84 ## Set the plot type based on linestyle. |
33 switch (fmt.errorstyle) | 85 switch (fmt.errorstyle) |
34 case "~" | 86 case "~" |
35 ifmt = "yerr"; | 87 ifmt = "yerr"; |
64 endif | 116 endif |
65 | 117 |
66 ## Must occur after __next_line_color__ in order to work correctly. | 118 ## Must occur after __next_line_color__ in order to work correctly. |
67 hg = hggroup ("parent", hax); | 119 hg = hggroup ("parent", hax); |
68 h = [h; hg]; | 120 h = [h; hg]; |
69 args = __add_datasource__ ("__errplot__", hg, | 121 args = __add_datasource__ ("__do_errplot__", hg, |
70 {"x", "y", "l", "u", "xl", "xu"}); | 122 {"x", "y", "l", "u", "xl", "xu"}); |
71 | 123 |
72 hl = [(__line__ (hg, "color", lc, "linestyle", "-", "marker", "none")), | 124 hl = [(__line__ (hg, "color", lc, "linestyle", "-", "marker", "none")), |
73 (__line__ (hg, "color", lc, "linestyle", ls, "marker", mk))]; | 125 (__line__ (hg, "color", lc, "linestyle", ls, "marker", mk))]; |
74 | 126 |