4007
|
1 ## Copyright (C) 2000, 2001, 2002 Teemu Ikonen |
3718
|
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. |
3718
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} __errplot__ (@var{args}) |
|
22 ## Really plot errorbar plots. User interface in function errorbar. |
4007
|
23 ## |
3718
|
24 ## @example |
|
25 ## __errplot__ (@var{arg1}, @var{arg2}, ..., @var{fmt}) |
|
26 ## @end example |
|
27 ## |
5642
|
28 ## @seealso{semilogx, semilogy, loglog, polar, mesh, contour, __pltopt__, |
5721
|
29 ## bar, stairs, errorbar, replot, xlabel, ylabel, title} |
3718
|
30 ## @end deftypefn |
5720
|
31 |
3718
|
32 ## Created: 18.7.2000 |
|
33 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> |
|
34 ## Keywords: errorbar, plotting |
|
35 |
6405
|
36 function h = __errplot__ (fstr, p, a1, a2, a3, a4, a5, a6) |
5406
|
37 |
6257
|
38 if (nargin < 4 || nargin > 8) # at least two data arguments needed |
6046
|
39 print_usage (); |
4897
|
40 endif |
4007
|
41 |
6146
|
42 [fmt, key] = __pltopt__ ("__errplot__", fstr); |
|
43 |
6172
|
44 [len, nplots] = size (a1); |
4007
|
45 |
4897
|
46 for i = 1:nplots |
6203
|
47 ifmt = fmt{1+mod(i-1,numel(fmt))}; |
6405
|
48 h = __line__ (p); |
6257
|
49 switch (nargin - 2) |
4897
|
50 case 2 |
6405
|
51 set (h, "xdata", (1:len)'); |
|
52 set (h, "ydata", a1(:,i)); |
|
53 set (h, "ldata", a2(:,i)); |
|
54 set (h, "udata", a2(:,i)); |
4897
|
55 case 3 |
6405
|
56 set (h, "xdata", a1(:,i)); |
|
57 set (h, "ydata", a2(:,i)); |
|
58 set (h, "ldata", a3(:,i)); |
|
59 set (h, "udata", a3(:,i)); |
4897
|
60 case 4 |
6405
|
61 set (h, "xdata", a1(:,i)); |
|
62 set (h, "ydata", a2(:,i)); |
6257
|
63 |
6168
|
64 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) |
6405
|
65 set (h, "xldata", a3(:,i)); |
|
66 set (h, "xudata", a3(:,i)); |
|
67 set (h, "ldata", a4(:,i)); |
|
68 set (h, "udata", a4(:,i)); |
6168
|
69 elseif (index (ifmt, "xerr")) |
6405
|
70 set (h, "xldata", a3(:,i)); |
|
71 set (h, "xudata", a4(:,i)); |
4897
|
72 else |
6405
|
73 set (h, "ldata", a3(:,i)); |
|
74 set (h, "udata", a4(:,i)); |
4897
|
75 endif |
|
76 case 5 |
|
77 error ("error plot requires 2, 3, 4 or 6 columns"); |
|
78 case 6 |
6405
|
79 set (h, "xdata", a1(:,i)); |
|
80 set (h, "ydata", a2(:,i)); |
|
81 set (h, "xldata", a3(:,i)); |
|
82 set (h, "xudata", a4(:,i)); |
|
83 set (h, "ldata", a5(:,i)); |
|
84 set (h, "udata", a6(:,i)); |
4897
|
85 endswitch |
5406
|
86 endfor |
|
87 |
4007
|
88 endfunction |