4019
|
1 ## Copyright (C) 2001, 2002 Teemu Ikonen |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
5307
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
4019
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} __errcomm__ (@var{args}) |
|
22 ## Common argument handling code for all error plots (errorbar, loglogerr, |
|
23 ## semilogyerr, semilogxerr). |
|
24 ## |
|
25 ## @end deftypefn |
5053
|
26 ## |
4019
|
27 ## @seealso{errorbar, semilogxerr, semilogyerr, loglogerr, __pltopt__} |
|
28 |
|
29 ## Created: 20.02.2001 |
|
30 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> |
|
31 ## Keywords: errorbar, plotting |
|
32 |
|
33 function __errcomm__ (caller, varargin) |
|
34 |
4897
|
35 if (nargin < 3) |
|
36 usage ("%s (x,y,dy,'fmt',...)", caller); |
4019
|
37 endif |
|
38 |
4897
|
39 nargs = length (varargin); |
4019
|
40 save_hold = ishold; |
|
41 unwind_protect |
|
42 if (! ishold) |
|
43 clg |
|
44 endif |
|
45 hold on; |
|
46 k = 1; |
4897
|
47 data = cell(6,1); |
|
48 while (k <= nargs) |
4019
|
49 a = varargin{k++}; |
4030
|
50 if (isvector (a)) |
4019
|
51 a = a(:); |
4030
|
52 elseif (ismatrix (a)) |
4019
|
53 ; |
|
54 else |
|
55 usage ("%s (...)", caller); |
|
56 endif |
|
57 sz = size (a); |
|
58 ndata = 1; |
4897
|
59 data{ndata} = a; |
|
60 while (k <= nargs) |
4019
|
61 a = varargin{k++}; |
|
62 if (isstr (a)) |
4897
|
63 __errplot__ (a, data{1:ndata}); |
4019
|
64 break; |
4030
|
65 elseif (isvector (a)) |
4019
|
66 a = a(:); |
4030
|
67 elseif (ismatrix (a)) |
4019
|
68 ; |
|
69 else |
|
70 error ("wrong argument types"); |
|
71 endif |
|
72 if (size (a) != sz) |
|
73 error ("argument sizes do not match"); |
|
74 endif |
4897
|
75 data{++ndata} = a; |
4019
|
76 if (ndata > 6) |
|
77 error ("too many arguments to a plot"); |
|
78 endif |
|
79 endwhile |
|
80 endwhile |
|
81 |
|
82 if (! isstr (a)) |
4897
|
83 __errplot__ ("~", data{1:ndata}); |
4019
|
84 endif |
|
85 unwind_protect_cleanup |
|
86 if (! save_hold) |
|
87 hold off; |
|
88 endif |
|
89 end_unwind_protect |
|
90 |
|
91 endfunction |