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__, |
|
29 ## bar, stairs, errorbar, replot, xlabel, ylabel, and title} |
3718
|
30 ## @end deftypefn |
|
31 ## Created: 18.7.2000 |
|
32 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> |
|
33 ## Keywords: errorbar, plotting |
|
34 |
5395
|
35 function __errplot__ (fstr, a1, a2, a3, a4, a5, a6) |
3718
|
36 |
5406
|
37 __plot_globals__; |
|
38 |
5493
|
39 __setup_plot__; |
|
40 |
4897
|
41 if (nargin < 3 || nargin > 7) # at least three data arguments needed |
|
42 usage ("__errplot__ (fmt, arg1, ...)"); |
|
43 endif |
4007
|
44 |
5493
|
45 j = __plot_data_offset__{__current_figure__}(__multiplot_xi__,__multiplot_yi__); |
5406
|
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 |
5493
|
75 __plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{j} = tmp; |
5406
|
76 |
5493
|
77 __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__} \ |
|
78 = sprintf ("%s%s __plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{%d} %s", |
|
79 __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}, |
5406
|
80 __plot_command_sep__, j, ifmt); |
|
81 __plot_command_sep__ = ",\\\n"; |
|
82 |
|
83 j++; |
|
84 |
|
85 endfor |
|
86 |
5493
|
87 __plot_data_offset__{__current_figure__}(__multiplot_xi__,__multiplot_yi__) = j; |
5406
|
88 |
5493
|
89 if (! isempty (__plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__})) |
|
90 if (__multiplot_mode__) |
|
91 __gnuplot_raw__ ("clear\n"); |
|
92 endif |
|
93 eval (__plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}); |
5406
|
94 endif |
3718
|
95 |
4007
|
96 endfunction |