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 |
7016
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
3718
|
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 |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
3718
|
18 |
6895
|
19 ## Undocumented internal function. |
5720
|
20 |
3718
|
21 ## Created: 18.7.2000 |
|
22 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> |
|
23 ## Keywords: errorbar, plotting |
|
24 |
6405
|
25 function h = __errplot__ (fstr, p, a1, a2, a3, a4, a5, a6) |
5406
|
26 |
6257
|
27 if (nargin < 4 || nargin > 8) # at least two data arguments needed |
6046
|
28 print_usage (); |
4897
|
29 endif |
4007
|
30 |
6146
|
31 [fmt, key] = __pltopt__ ("__errplot__", fstr); |
|
32 |
6172
|
33 [len, nplots] = size (a1); |
4007
|
34 |
4897
|
35 for i = 1:nplots |
6736
|
36 ## Set the plot type based on linestyle. |
|
37 if (fmt.linestyle == "~") |
|
38 ifmt = "yerr"; |
|
39 elseif (fmt.linestyle == ">") |
|
40 ifmt = "xerr"; |
|
41 elseif (fmt.linestyle == "~>") |
|
42 ifmt = "xyerr"; |
|
43 elseif (fmt.linestyle == "#") |
|
44 ifmt = "box"; |
|
45 elseif (fmt.linestyle == "#~") |
|
46 ifmt = "boxy"; |
|
47 elseif (fmt.linestyle == "#~>") |
|
48 ifmt = "boxxy"; |
|
49 else |
|
50 print_usage (); |
|
51 endif |
|
52 |
6405
|
53 h = __line__ (p); |
6736
|
54 |
6257
|
55 switch (nargin - 2) |
4897
|
56 case 2 |
6405
|
57 set (h, "xdata", (1:len)'); |
|
58 set (h, "ydata", a1(:,i)); |
|
59 set (h, "ldata", a2(:,i)); |
|
60 set (h, "udata", a2(:,i)); |
4897
|
61 case 3 |
6405
|
62 set (h, "xdata", a1(:,i)); |
|
63 set (h, "ydata", a2(:,i)); |
|
64 set (h, "ldata", a3(:,i)); |
|
65 set (h, "udata", a3(:,i)); |
4897
|
66 case 4 |
6405
|
67 set (h, "xdata", a1(:,i)); |
|
68 set (h, "ydata", a2(:,i)); |
6257
|
69 |
6168
|
70 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) |
6405
|
71 set (h, "xldata", a3(:,i)); |
|
72 set (h, "xudata", a3(:,i)); |
|
73 set (h, "ldata", a4(:,i)); |
|
74 set (h, "udata", a4(:,i)); |
6168
|
75 elseif (index (ifmt, "xerr")) |
6405
|
76 set (h, "xldata", a3(:,i)); |
|
77 set (h, "xudata", a4(:,i)); |
4897
|
78 else |
6405
|
79 set (h, "ldata", a3(:,i)); |
|
80 set (h, "udata", a4(:,i)); |
4897
|
81 endif |
|
82 case 5 |
|
83 error ("error plot requires 2, 3, 4 or 6 columns"); |
|
84 case 6 |
6405
|
85 set (h, "xdata", a1(:,i)); |
|
86 set (h, "ydata", a2(:,i)); |
|
87 set (h, "xldata", a3(:,i)); |
|
88 set (h, "xudata", a4(:,i)); |
|
89 set (h, "ldata", a5(:,i)); |
|
90 set (h, "udata", a6(:,i)); |
4897
|
91 endswitch |
5406
|
92 endfor |
|
93 |
4007
|
94 endfunction |