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 ## |
|
28 ## @end deftypefn |
5053
|
29 ## |
3718
|
30 ## @seealso{semilogx, semilogy, loglog, polar, mesh, contour, __pltopt__ |
5214
|
31 ## bar, stairs, errorbar, replot, xlabel, ylabel, and title} |
3718
|
32 |
|
33 ## Created: 18.7.2000 |
|
34 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> |
|
35 ## Keywords: errorbar, plotting |
|
36 |
5395
|
37 function __errplot__ (fstr, a1, a2, a3, a4, a5, a6) |
3718
|
38 |
5406
|
39 __plot_globals__; |
|
40 |
4897
|
41 if (nargin < 3 || nargin > 7) # at least three data arguments needed |
|
42 usage ("__errplot__ (fmt, arg1, ...)"); |
|
43 endif |
4007
|
44 |
5406
|
45 j = __plot_data_offset__(__current_figure__); |
|
46 |
3718
|
47 fmt = __pltopt__ ("__errplot__", fstr); |
4007
|
48 |
4897
|
49 nplots = size (a1, 2); |
|
50 len = size (a1, 1); |
|
51 for i = 1:nplots |
|
52 ifmt = fmt(1+mod(i,size(fmt,1)), :); |
|
53 switch (nargin - 1) |
|
54 case 2 |
|
55 tmp = [(1:len)', a1(:,i), a2(:,i)]; |
|
56 case 3 |
|
57 tmp = [a1(:,i), a2(:,i), a3(:,i)]; |
|
58 case 4 |
|
59 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) |
|
60 tmp = [a1(:,i), a2(:,i), a3(:,i), a4(:,i)]; |
|
61 elseif (index (ifmt, "xerr")) |
|
62 tmp = [a1(:,i), a2(:,i), a1(:,i)-a3(:,i), a1(:,i)+a4(:,i)]; |
|
63 else |
|
64 tmp = [a1(:,i), a2(:,i), a2(:,i)-a3(:,i), a2(:,i)+a4(:,i)]; |
|
65 endif |
|
66 case 5 |
|
67 error ("error plot requires 2, 3, 4 or 6 columns"); |
|
68 ## tmp = [a1(:,i), a2(:,i), a3(:,i), a4(:,i), a5(:,i)]; |
|
69 case 6 |
|
70 tmp = [a1(:,i), a2(:,i), ... |
|
71 a1(:,i)-a3(:,i), a1(:,i)+a4(:,i), ... |
|
72 a2(:,i)-a5(:,i), a2(:,i)+a6(:,i)]; |
|
73 endswitch |
5406
|
74 |
|
75 __plot_data__{__current_figure__}{j} = tmp; |
|
76 |
|
77 __plot_command__{__current_figure__} \ |
|
78 = sprintf ("%s%s __plot_data__{__current_figure__}{%d} %s", |
|
79 __plot_command__{__current_figure__}, |
|
80 __plot_command_sep__, j, ifmt); |
|
81 __plot_command_sep__ = ",\\\n"; |
|
82 |
|
83 j++; |
|
84 |
|
85 endfor |
|
86 |
|
87 __plot_data_offset__(__current_figure__) = j; |
|
88 |
|
89 if (! isempty (__plot_command__{__current_figure__})) |
|
90 eval (__plot_command__{__current_figure__}); |
|
91 endif |
3718
|
92 |
4007
|
93 endfunction |