7017
|
1 ## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
|
2 ## Teemu Ikonen |
3718
|
3 ## |
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
|
7 ## under the terms of the GNU General Public License as published by |
7016
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
3718
|
10 ## |
|
11 ## Octave is distributed in the hope that it will be useful, but |
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 ## General Public License for more details. |
|
15 ## |
|
16 ## You should have received a copy of the GNU General Public License |
7016
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
3718
|
19 |
6895
|
20 ## Undocumented internal function. |
5720
|
21 |
3718
|
22 ## Created: 18.7.2000 |
|
23 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> |
|
24 ## Keywords: errorbar, plotting |
|
25 |
6405
|
26 function h = __errplot__ (fstr, p, a1, a2, a3, a4, a5, a6) |
5406
|
27 |
6257
|
28 if (nargin < 4 || nargin > 8) # at least two data arguments needed |
6046
|
29 print_usage (); |
4897
|
30 endif |
4007
|
31 |
6146
|
32 [fmt, key] = __pltopt__ ("__errplot__", fstr); |
|
33 |
6172
|
34 [len, nplots] = size (a1); |
4007
|
35 |
4897
|
36 for i = 1:nplots |
6736
|
37 ## Set the plot type based on linestyle. |
|
38 if (fmt.linestyle == "~") |
|
39 ifmt = "yerr"; |
|
40 elseif (fmt.linestyle == ">") |
|
41 ifmt = "xerr"; |
|
42 elseif (fmt.linestyle == "~>") |
|
43 ifmt = "xyerr"; |
|
44 elseif (fmt.linestyle == "#") |
|
45 ifmt = "box"; |
|
46 elseif (fmt.linestyle == "#~") |
|
47 ifmt = "boxy"; |
|
48 elseif (fmt.linestyle == "#~>") |
|
49 ifmt = "boxxy"; |
|
50 else |
|
51 print_usage (); |
|
52 endif |
|
53 |
6405
|
54 h = __line__ (p); |
6736
|
55 |
6257
|
56 switch (nargin - 2) |
4897
|
57 case 2 |
6405
|
58 set (h, "xdata", (1:len)'); |
|
59 set (h, "ydata", a1(:,i)); |
|
60 set (h, "ldata", a2(:,i)); |
|
61 set (h, "udata", a2(:,i)); |
4897
|
62 case 3 |
6405
|
63 set (h, "xdata", a1(:,i)); |
|
64 set (h, "ydata", a2(:,i)); |
|
65 set (h, "ldata", a3(:,i)); |
|
66 set (h, "udata", a3(:,i)); |
4897
|
67 case 4 |
6405
|
68 set (h, "xdata", a1(:,i)); |
|
69 set (h, "ydata", a2(:,i)); |
6257
|
70 |
6168
|
71 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) |
6405
|
72 set (h, "xldata", a3(:,i)); |
|
73 set (h, "xudata", a3(:,i)); |
|
74 set (h, "ldata", a4(:,i)); |
|
75 set (h, "udata", a4(:,i)); |
6168
|
76 elseif (index (ifmt, "xerr")) |
6405
|
77 set (h, "xldata", a3(:,i)); |
|
78 set (h, "xudata", a4(:,i)); |
4897
|
79 else |
6405
|
80 set (h, "ldata", a3(:,i)); |
|
81 set (h, "udata", a4(:,i)); |
4897
|
82 endif |
|
83 case 5 |
|
84 error ("error plot requires 2, 3, 4 or 6 columns"); |
|
85 case 6 |
6405
|
86 set (h, "xdata", a1(:,i)); |
|
87 set (h, "ydata", a2(:,i)); |
|
88 set (h, "xldata", a3(:,i)); |
|
89 set (h, "xudata", a4(:,i)); |
|
90 set (h, "ldata", a5(:,i)); |
|
91 set (h, "udata", a6(:,i)); |
4897
|
92 endswitch |
5406
|
93 endfor |
|
94 |
4007
|
95 endfunction |