annotate scripts/plot/area.m @ 10834:05ba991794d4

Improvements for fltk printing.
author Ben Abbott <bpabbott@mac.com>
date Thu, 29 Jul 2010 19:44:07 -0400
parents be55736a0783
children fd0a3ac60b0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9245
16f53d29049f update copyright notices
John W. Eaton <jwe@octave.org>
parents: 9040
diff changeset
1 ## Copyright (C) 2007, 2008, 2009 Michael Goffioul
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
2 ## Copyright (C) 2007, 2008, 2009 David Bateman
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
3 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
4 ## This file is part of Octave.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
5 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
7 ## under the terms of the GNU General Public License as published by
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
9 ## your option) any later version.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
10 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
14 ## General Public License for more details.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
15 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
18 ## <http://www.gnu.org/licenses/>.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
19
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
20 ## -*- texinfo -*-
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
21 ## @deftypefn {Function File} {} area (@var{x}, @var{y})
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
22 ## @deftypefnx {Function File} {} area (@var{x}, @var{y}, @var{lvl})
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
23 ## @deftypefnx {Function File} {} area (@dots{}, @var{prop}, @var{val}, @dots{})
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
24 ## @deftypefnx {Function File} {} area (@var{y}, @dots{})
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
25 ## @deftypefnx {Function File} {} area (@var{h}, @dots{})
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
26 ## @deftypefnx {Function File} {@var{h} =} area (@dots{})
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
27 ## Area plot of cumulative sum of the columns of @var{y}. This shows the
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
28 ## contributions of a value to a sum, and is functionally similar to
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
29 ## @code{plot (@var{x}, cumsum (@var{y}, 2))}, except that the area under
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
30 ## the curve is shaded.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
31 ##
8325
b93ac0586e4b spelling corrections
Brian Gough<bjg@network-theory.co.uk>
parents: 8056
diff changeset
32 ## If the @var{x} argument is omitted it is assumed to be given by
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
33 ## @code{1 : rows (@var{y})}. A value @var{lvl} can be defined that determines
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
34 ## where the base level of the shading under the curve should be defined.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
35 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
36 ## Additional arguments to the @code{area} function are passed to the
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
37 ## @code{patch}. The optional return value @var{h} provides a handle to
8056
9a6f4713f765 Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents: 7215
diff changeset
38 ## area series object representing the patches of the areas.
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
39 ## @seealso{plot, patch}
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
40 ## @end deftypefn
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
41
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
42 function h = area (varargin)
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
43
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
44 [ax, varargin, nargin] = __plt_get_axis_arg__ ("area", varargin{:});
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
45
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
46 if (nargin > 0)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
47 idx = 1;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
48 x = y = [];
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
49 bv = 0;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
50 args = {};
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
51 ## Check for (X) or (X,Y) arguments and possible base value.
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
52 if (nargin >= idx && ismatrix (varargin{idx}))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
53 y = varargin{idx};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
54 idx++;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
55 if (nargin >= idx)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
56 if (isscalar (varargin{idx}))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
57 bv = varargin{idx};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
58 idx++;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
59 elseif (ismatrix (varargin{idx}))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
60 x = y;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
61 y = varargin{idx};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
62 idx++;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
63 if (nargin >= idx && isscalar (varargin{idx}))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
64 bv = varargin{idx};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
65 idx++;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
66 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
67 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
68 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
69 else
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
70 print_usage ();
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
71 endif
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
72 ## Check for additional args.
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
73 if (nargin >= idx)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
74 args = {varargin{idx:end}};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
75 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
76 newplot ();
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
77 if (isvector (y))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
78 y = y(:);
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
79 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
80 if (isempty (x))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
81 x = repmat ([1:size(y, 1)]', 1, size (y, 2));
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
82 elseif (isvector (x))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
83 x = repmat (x(:), 1, size (y, 2));
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
84 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
85
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
86 oldax = gca ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
87 unwind_protect
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
88 axes (ax);
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
89 tmp = __area__ (ax, x, y, bv, args{:});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
90 unwind_protect_cleanup
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
91 axes (oldax);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
92 end_unwind_protect
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
93
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
94 if (nargout > 0)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
95 h = tmp;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
96 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
97 else
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
98 print_usage ();
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
99 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
100
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
101 endfunction
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
102
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
103 function retval = __area__ (ax, x, y, bv, varargin)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
104
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
105 y0 = bv * ones (1, rows (y));
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
106 y0 = zeros (1, rows (y));
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
107 retval = [];
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
108 for i = 1: size (y, 2);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
109 hg = hggroup ();
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
110 retval = [retval; hg];
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
111 args = __add_datasource__ ("area", hg, {"x", "y"}, varargin{:});
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
112
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
113 x1 = x(:, 1).';
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
114 y1 = y (:, i).';
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
115 addproperty ("xdata", hg, "data", x1);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
116 addproperty ("ydata", hg, "data", y1);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
117
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
118 addlistener (hg, "xdata", @update_data);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
119 addlistener (hg, "ydata", @update_data);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
120
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
121 if (i == 1)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
122 h = patch (ax, [x1(1), x1, fliplr(x1)], [bv, y1, bv*ones(1, length(y1))],
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
123 __next_line_color__ (), "parent", hg);
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
124 else
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
125 y1 = y0 + y1;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
126 h = patch (ax, [x1(1), x1, fliplr(x1)], [y0(1), y1, fliplr(y0)],
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
127 __next_line_color__ (), "parent", hg);
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
128 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
129
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
130 y0 = y1;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
131
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
132 addproperty ("basevalue", hg, "data", bv);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
133 addlistener (hg, "basevalue", @move_baseline);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
134
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
135 addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
136 addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
137 addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
138 addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
139
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
140 addlistener (hg, "edgecolor", @update_props);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
141 addlistener (hg, "linewidth", @update_props);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
142 addlistener (hg, "linestyle", @update_props);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
143 addlistener (hg, "facecolor", @update_props);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
144
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
145 addproperty ("areagroup", hg, "data");
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
146 set (retval, "areagroup", retval);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
147
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
148 if (! isempty (args))
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
149 set (hg, args{:});
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
150 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
151 endfor
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
152
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
153 endfunction
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
154
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
155 function update_props (h, d)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
156 kids = get (h, "children");
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
157 set (kids, "edgecolor", get (h, "edgecolor"),
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
158 "linewidth", get (h, "linewidth"),
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
159 "linestyle", get (h, "linestyle"),
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
160 "facecolor", get (h, "facecolor"));
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
161 endfunction
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
162
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
163 function move_baseline (h, d)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
164 persistent recursion = false;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
165
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
166 ## Don't allow recursion
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
167 if (! recursion)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
168 unwind_protect
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
169 recursion = true;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
170 hlist = get (h, "areagroup");
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
171 b0 = get (h, "basevalue");
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
172
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
173 for hh = hlist(:)'
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
174 if (hh != h)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
175 b1 = get (hh, "basevalue");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
176 if (b1 != b0)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
177 set (hh, "basevalue", b0);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
178 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
179 endif
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
180 endfor
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
181 update_data (h, d);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
182 unwind_protect_cleanup
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
183 recursion = false;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
184 end_unwind_protect
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
185 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
186 endfunction
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
187
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
188 function update_data (h, d)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
189 hlist = get (h, "areagroup");
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
190 bv = get (h, "basevalue");
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
191 for i = 1 : length (hlist)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
192 hh = hlist(i);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
193 x1 = get (hh, "xdata")(:);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
194 y1 = get (hh, "ydata")(:);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
195
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
196 set (get (hh, "children"), "xdata", [x1(1); x1; flipud(x1)]);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
197 if (i == 1)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
198 set (get (hh, "children"), "ydata", [bv; y1; bv*ones(length(y1), 1)]);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
199 else
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
200 y1 = y0 + y1;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
201 set (get (hh, "children"), "ydata", [y0(1); y1; flipud(y0)]);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
202 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
203
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
204 y0 = y1;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
205 endfor
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
206 endfunction