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 |
5395
|
36 function __errplot__ (fstr, a1, a2, a3, a4, a5, a6) |
3718
|
37 |
5406
|
38 __plot_globals__; |
|
39 |
6146
|
40 cf = __current_figure__; |
6163
|
41 mxi = __multiplot_xi__(cf); |
|
42 myi = __multiplot_yi__(cf); |
6146
|
43 |
6004
|
44 __setup_plot__ ("__gnuplot_plot__"); |
5493
|
45 |
4897
|
46 if (nargin < 3 || nargin > 7) # at least three data arguments needed |
6046
|
47 print_usage (); |
4897
|
48 endif |
4007
|
49 |
6146
|
50 j = __plot_data_offset__{cf}(mxi,myi); |
|
51 |
|
52 [fmt, key] = __pltopt__ ("__errplot__", fstr); |
|
53 |
6172
|
54 [len, nplots] = size (a1); |
4007
|
55 |
4897
|
56 for i = 1:nplots |
6172
|
57 ifmt = fmt{1+mod(i-1,numel(fmt))} |
4897
|
58 switch (nargin - 1) |
|
59 case 2 |
|
60 tmp = [(1:len)', a1(:,i), a2(:,i)]; |
|
61 case 3 |
|
62 tmp = [a1(:,i), a2(:,i), a3(:,i)]; |
|
63 case 4 |
6168
|
64 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) |
4897
|
65 tmp = [a1(:,i), a2(:,i), a3(:,i), a4(:,i)]; |
6168
|
66 elseif (index (ifmt, "xerr")) |
4897
|
67 tmp = [a1(:,i), a2(:,i), a1(:,i)-a3(:,i), a1(:,i)+a4(:,i)]; |
|
68 else |
|
69 tmp = [a1(:,i), a2(:,i), a2(:,i)-a3(:,i), a2(:,i)+a4(:,i)]; |
|
70 endif |
|
71 case 5 |
|
72 error ("error plot requires 2, 3, 4 or 6 columns"); |
|
73 ## tmp = [a1(:,i), a2(:,i), a3(:,i), a4(:,i), a5(:,i)]; |
|
74 case 6 |
|
75 tmp = [a1(:,i), a2(:,i), ... |
|
76 a1(:,i)-a3(:,i), a1(:,i)+a4(:,i), ... |
|
77 a2(:,i)-a5(:,i), a2(:,i)+a6(:,i)]; |
|
78 endswitch |
5406
|
79 |
6172
|
80 __plot_data__{cf}{mxi,myi}{j}{i} = tmp; |
|
81 __plot_data_type__{cf}{mxi,myi}(j) = 2; |
|
82 __plot_fmtstr__{cf}{mxi,myi}{j}{i} = ifmt; |
|
83 __plot_key_labels__{cf}{mxi,myi}{j} = key; |
|
84 __plot_usingstr__{cf}{mxi,myi}{j}{i} = ""; |
|
85 __plot_withstr__{cf}{mxi,myi}{j}{i} = ""; |
5406
|
86 |
|
87 endfor |
|
88 |
6172
|
89 __plot_data_offset__{cf}(mxi,myi) = ++j; |
5406
|
90 |
6172
|
91 __render_plot__ (); |
3718
|
92 |
4007
|
93 endfunction |