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 |
|
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
|
18 ## 02111-1307, USA. |
|
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 |
|
26 ## @seealso{errorbar, semilogxerr, semilogyerr, loglogerr, __pltopt__} |
|
27 |
|
28 ## Created: 20.02.2001 |
|
29 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> |
|
30 ## Keywords: errorbar, plotting |
|
31 |
|
32 function __errcomm__ (caller, varargin) |
|
33 |
4897
|
34 if (nargin < 3) |
|
35 usage ("%s (x,y,dy,'fmt',...)", caller); |
4019
|
36 endif |
|
37 |
4897
|
38 nargs = length (varargin); |
4019
|
39 save_hold = ishold; |
|
40 unwind_protect |
|
41 if (! ishold) |
|
42 clg |
|
43 endif |
|
44 hold on; |
|
45 k = 1; |
4897
|
46 data = cell(6,1); |
|
47 while (k <= nargs) |
4019
|
48 a = varargin{k++}; |
4030
|
49 if (isvector (a)) |
4019
|
50 a = a(:); |
4030
|
51 elseif (ismatrix (a)) |
4019
|
52 ; |
|
53 else |
|
54 usage ("%s (...)", caller); |
|
55 endif |
|
56 sz = size (a); |
|
57 ndata = 1; |
4897
|
58 data{ndata} = a; |
|
59 while (k <= nargs) |
4019
|
60 a = varargin{k++}; |
|
61 if (isstr (a)) |
4897
|
62 __errplot__ (a, data{1:ndata}); |
4019
|
63 break; |
4030
|
64 elseif (isvector (a)) |
4019
|
65 a = a(:); |
4030
|
66 elseif (ismatrix (a)) |
4019
|
67 ; |
|
68 else |
|
69 error ("wrong argument types"); |
|
70 endif |
|
71 if (size (a) != sz) |
|
72 error ("argument sizes do not match"); |
|
73 endif |
4897
|
74 data{++ndata} = a; |
4019
|
75 if (ndata > 6) |
|
76 error ("too many arguments to a plot"); |
|
77 endif |
|
78 endwhile |
|
79 endwhile |
|
80 |
|
81 if (! isstr (a)) |
4897
|
82 __errplot__ ("~", data{1:ndata}); |
4019
|
83 endif |
|
84 unwind_protect_cleanup |
|
85 if (! save_hold) |
|
86 hold off; |
|
87 endif |
|
88 end_unwind_protect |
|
89 |
|
90 endfunction |