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 |
4897
|
39 if (nargin < 3 || nargin > 7) # at least three data arguments needed |
|
40 usage ("__errplot__ (fmt, arg1, ...)"); |
|
41 endif |
4007
|
42 |
3718
|
43 fmt = __pltopt__ ("__errplot__", fstr); |
4007
|
44 |
4897
|
45 nplots = size (a1, 2); |
|
46 len = size (a1, 1); |
|
47 for i = 1:nplots |
|
48 ifmt = fmt(1+mod(i,size(fmt,1)), :); |
|
49 switch (nargin - 1) |
|
50 case 2 |
|
51 tmp = [(1:len)', a1(:,i), a2(:,i)]; |
|
52 case 3 |
|
53 tmp = [a1(:,i), a2(:,i), a3(:,i)]; |
|
54 case 4 |
|
55 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) |
|
56 tmp = [a1(:,i), a2(:,i), a3(:,i), a4(:,i)]; |
|
57 elseif (index (ifmt, "xerr")) |
|
58 tmp = [a1(:,i), a2(:,i), a1(:,i)-a3(:,i), a1(:,i)+a4(:,i)]; |
|
59 else |
|
60 tmp = [a1(:,i), a2(:,i), a2(:,i)-a3(:,i), a2(:,i)+a4(:,i)]; |
|
61 endif |
|
62 case 5 |
|
63 error ("error plot requires 2, 3, 4 or 6 columns"); |
|
64 ## tmp = [a1(:,i), a2(:,i), a3(:,i), a4(:,i), a5(:,i)]; |
|
65 case 6 |
|
66 tmp = [a1(:,i), a2(:,i), ... |
|
67 a1(:,i)-a3(:,i), a1(:,i)+a4(:,i), ... |
|
68 a2(:,i)-a5(:,i), a2(:,i)+a6(:,i)]; |
|
69 endswitch |
5215
|
70 cmd = sprintf ("__gnuplot_plot__ tmp %s", ifmt); |
4897
|
71 eval (cmd); |
|
72 endfor |
3718
|
73 |
4007
|
74 endfunction |