Mercurial > hg > octave-lyh
annotate scripts/plot/stairs.m @ 11191:01ddaedd6ad5
Reverse changeset b1f4bdc276b6. Use all lower case for "uniformoutput" option.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Thu, 04 Nov 2010 12:18:08 -0700 |
parents | 14af8004945d |
children | a0dfd7e8e3e2 |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2004, |
8920 | 2 ## 2005, 2006, 2007, 2008 John W. Eaton |
2313 | 3 ## |
4 ## This file is part of Octave. | |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
2313 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
15 ## | |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
245 | 19 |
3368 | 20 ## -*- texinfo -*- |
10736
14af8004945d
stairs.m: Add additional calling forms to documentation
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
21 ## @deftypefn {Function File} {} stairs (@var{y}) |
14af8004945d
stairs.m: Add additional calling forms to documentation
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
22 ## @deftypefnx {Function File} {} stairs (@var{x}, @var{y}) |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
23 ## @deftypefnx {Function File} {} stairs (@dots{}, @var{style}) |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
24 ## @deftypefnx {Function File} {} stairs (@dots{}, @var{prop}, @var{val}) |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
25 ## @deftypefnx {Function File} {} stairs (@var{h}, @dots{}) |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
26 ## @deftypefnx {Function File} {@var{h} =} stairs (@dots{}) |
10736
14af8004945d
stairs.m: Add additional calling forms to documentation
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
27 ## @deftypefnx {Function File} {[@var{xstep}, @var{ystep}] =} stairs (@dots{}) |
6895 | 28 ## Produce a stairstep plot. The arguments may be vectors or matrices. |
3426 | 29 ## |
2311 | 30 ## If only one argument is given, it is taken as a vector of y-values |
3368 | 31 ## and the x coordinates are taken to be the indices of the elements. |
3426 | 32 ## |
10736
14af8004945d
stairs.m: Add additional calling forms to documentation
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
33 ## If one output argument is requested, return a graphics handle to the plot. |
2311 | 34 ## If two output arguments are specified, the data are generated but |
35 ## not plotted. For example, | |
3426 | 36 ## |
3368 | 37 ## @example |
38 ## stairs (x, y); | |
39 ## @end example | |
3426 | 40 ## |
3368 | 41 ## @noindent |
2311 | 42 ## and |
3426 | 43 ## |
3368 | 44 ## @example |
6895 | 45 ## @group |
3368 | 46 ## [xs, ys] = stairs (x, y); |
47 ## plot (xs, ys); | |
6895 | 48 ## @end group |
3368 | 49 ## @end example |
3426 | 50 ## |
3368 | 51 ## @noindent |
2311 | 52 ## are equivalent. |
5642 | 53 ## @seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour, |
6448 | 54 ## bar, xlabel, ylabel, title} |
3368 | 55 ## @end deftypefn |
4 | 56 |
2314 | 57 ## Author: jwe |
58 | |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
59 function [xs, ys] = stairs (varargin) |
4 | 60 |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
61 [ax, varargin, nargin] = __plt_get_axis_arg__ ("stairs", varargin{:}); |
4 | 62 |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
63 if (nargin < 1) |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
64 print_usage (); |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
65 else |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
66 if (nargout > 1) |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
67 [h, xs, ys] = __stairs__ (false, varargin{:}); |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
68 else |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
69 oldax = gca (); |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
70 unwind_protect |
10549 | 71 axes (ax); |
72 newplot (); | |
73 [h, xxs, yys] = __stairs__ (true, varargin{:}); | |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
74 unwind_protect_cleanup |
10549 | 75 axes (oldax); |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
76 end_unwind_protect |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
77 endif |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
78 if (nargout == 1) |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
79 xs = h; |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
80 endif |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
81 endif |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
82 endfunction |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
83 |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
84 function [h, xs, ys] = __stairs__ (doplot, varargin) |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
85 |
9809
965487e00282
stairs.m (__stairs__): correct nargin check; new demos
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
86 if (nargin == 2 || ischar (varargin{2})) |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
87 y = varargin {1}; |
8070
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
8056
diff
changeset
|
88 varargin(1) = []; |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
89 if (ismatrix (y)) |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
90 if (isvector (y)) |
10549 | 91 y = y(:); |
6257 | 92 endif |
93 x = 1:rows (y); | |
4 | 94 endif |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
95 else |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
96 x = varargin{1}; |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
97 y = varargin{2}; |
8070
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
8056
diff
changeset
|
98 varargin(1:2) = []; |
6257 | 99 endif |
100 | |
101 if (ndims (x) > 2 || ndims (y) > 2) | |
102 error ("stairs: expecting 2-d arguments"); | |
103 endif | |
104 | |
105 vec_x = isvector (x); | |
106 | |
107 if (vec_x) | |
108 x = x(:); | |
109 endif | |
110 | |
111 if (isvector (y)) | |
112 y = y(:); | |
113 endif | |
114 | |
115 if (ismatrix (y)) | |
116 [nr, nc] = size (y); | |
117 if (vec_x) | |
118 x = repmat (x, [1, nc]); | |
119 else | |
120 [x_nr, x_nc] = size (x); | |
121 if (x_nr != nr || x_nc != nc) | |
10549 | 122 error ("stairs: argument size mismatch"); |
4 | 123 endif |
124 endif | |
125 endif | |
126 | |
6257 | 127 len = 2*nr - 1; |
128 | |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
129 xs = ys = zeros (len, nc); |
6257 | 130 |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
131 xs(1,:) = x(1,:); |
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
132 ys(1,:) = y(1,:); |
6257 | 133 |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
134 xtmp = x(2:nr,:); |
6257 | 135 ridx = 2:2:len-1; |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
136 xs(ridx,:) = xtmp; |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
137 ys(ridx,:) = y(1:nr-1,:); |
6257 | 138 |
139 ridx = 3:2:len; | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
140 xs(ridx,:) = xtmp; |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
141 ys(ridx,:) = y(2:nr,:); |
6257 | 142 |
8243
ec4d9d657b17
Treat line style argument in stairs
David Bateman <dbateman@free.fr>
parents:
8079
diff
changeset
|
143 have_line_spec = false; |
8244 | 144 for i = 1 : length (varargin) |
8243
ec4d9d657b17
Treat line style argument in stairs
David Bateman <dbateman@free.fr>
parents:
8079
diff
changeset
|
145 arg = varargin {i}; |
ec4d9d657b17
Treat line style argument in stairs
David Bateman <dbateman@free.fr>
parents:
8079
diff
changeset
|
146 if ((ischar (arg) || iscell (arg)) && ! have_line_spec) |
ec4d9d657b17
Treat line style argument in stairs
David Bateman <dbateman@free.fr>
parents:
8079
diff
changeset
|
147 [linespec, valid] = __pltopt__ ("stairs", arg, false); |
ec4d9d657b17
Treat line style argument in stairs
David Bateman <dbateman@free.fr>
parents:
8079
diff
changeset
|
148 if (valid) |
10549 | 149 have_line_spec = true; |
150 varargin(i) = []; | |
151 break; | |
8243
ec4d9d657b17
Treat line style argument in stairs
David Bateman <dbateman@free.fr>
parents:
8079
diff
changeset
|
152 endif |
ec4d9d657b17
Treat line style argument in stairs
David Bateman <dbateman@free.fr>
parents:
8079
diff
changeset
|
153 endif |
ec4d9d657b17
Treat line style argument in stairs
David Bateman <dbateman@free.fr>
parents:
8079
diff
changeset
|
154 endfor |
ec4d9d657b17
Treat line style argument in stairs
David Bateman <dbateman@free.fr>
parents:
8079
diff
changeset
|
155 |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
156 if (doplot) |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
157 h = []; |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
158 unwind_protect |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
159 hold_state = get (gca (), "nextplot"); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
160 for i = 1 : size(y, 2) |
10549 | 161 hg = hggroup (); |
162 h = [h; hg]; | |
163 args = __add_datasource__ ("stairs", hg, {"x", "y"}, varargin{:}); | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
164 |
10549 | 165 addproperty ("xdata", hg, "data", x(:,i).'); |
166 addproperty ("ydata", hg, "data", y(:,i).'); | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
167 |
10549 | 168 addlistener (hg, "xdata", @update_data); |
169 addlistener (hg, "ydata", @update_data); | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
170 |
10549 | 171 if (have_line_spec) |
172 tmp = line (xs(:,i).', ys(:,i).', "color", linespec.color, | |
173 "parent", hg); | |
174 else | |
175 tmp = line (xs(:,i).', ys(:,i).', "color", __next_line_color__ (), | |
176 "parent", hg); | |
177 endif | |
8075
a028a5960e18
Fix for hold with no figures/axes. Set prop/val pairs to hggroups rather than underlying objects. Fix for equality test in array_property
David Bateman <dbateman@free.fr>
parents:
8070
diff
changeset
|
178 |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
179 addproperty ("color", hg, "linecolor", get (tmp, "color")); |
10549 | 180 addproperty ("linewidth", hg, "linelinewidth", get (tmp, "linewidth")); |
181 addproperty ("linestyle", hg, "linelinestyle", get (tmp, "linestyle")); | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
182 |
10549 | 183 addproperty ("marker", hg, "linemarker", get (tmp, "marker")); |
184 addproperty ("markerfacecolor", hg, "linemarkerfacecolor", | |
185 get (tmp, "markerfacecolor")); | |
186 addproperty ("markeredgecolor", hg, "linemarkeredgecolor", | |
187 get (tmp, "markeredgecolor")); | |
188 addproperty ("markersize", hg, "linemarkersize", | |
189 get (tmp, "markersize")); | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
190 |
10549 | 191 addlistener (hg, "color", @update_props); |
192 addlistener (hg, "linewidth", @update_props); | |
193 addlistener (hg, "linestyle", @update_props); | |
194 addlistener (hg, "marker", @update_props); | |
195 addlistener (hg, "markerfacecolor", @update_props); | |
196 addlistener (hg, "markeredgecolor", @update_props); | |
197 addlistener (hg, "markersize", @update_props); | |
8075
a028a5960e18
Fix for hold with no figures/axes. Set prop/val pairs to hggroups rather than underlying objects. Fix for equality test in array_property
David Bateman <dbateman@free.fr>
parents:
8070
diff
changeset
|
198 |
10549 | 199 if (! isempty (args)) |
200 set (hg, args{:}); | |
201 endif | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
202 endfor |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
203 unwind_protect_cleanup |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
204 set (gca (), "nextplot", hold_state); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
205 end_unwind_protect |
736 | 206 else |
7746
95dce69538ec
Allow additional options to stairs plots
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
207 h = 0; |
4 | 208 endif |
209 | |
210 endfunction | |
7245 | 211 |
212 %!demo | |
213 %! x = 1:10; | |
214 %! y = rand (1, 10); | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
215 %! stairs (x, y); |
7245 | 216 |
217 %!demo | |
218 %! x = 1:10; | |
219 %! y = rand (1, 10); | |
220 %! [xs, ys] = stairs (x, y); | |
221 %! plot (xs, ys); | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
222 |
9809
965487e00282
stairs.m (__stairs__): correct nargin check; new demos
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
223 %!demo |
965487e00282
stairs.m (__stairs__): correct nargin check; new demos
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
224 %! stairs (1:9); |
965487e00282
stairs.m (__stairs__): correct nargin check; new demos
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
225 |
965487e00282
stairs.m (__stairs__): correct nargin check; new demos
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
226 %!demo |
965487e00282
stairs.m (__stairs__): correct nargin check; new demos
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
227 %! [xs, ys] = stairs (9:-1:1); |
965487e00282
stairs.m (__stairs__): correct nargin check; new demos
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
228 %! plot (xs, ys); |
965487e00282
stairs.m (__stairs__): correct nargin check; new demos
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
229 |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
230 function update_props (h, d) |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
231 set (get (h, "children"), "color", get (h, "color"), |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
232 "linewidth", get (h, "linewidth"), |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
233 "linestyle", get (h, "linestyle"), |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
234 "marker", get (h, "marker"), |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
235 "markerfacecolor", get (h, "markerfacecolor"), |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
236 "markeredgecolor", get (h, "markeredgecolor"), |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
237 "markersize", get (h, "markersize")); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
238 endfunction |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
239 |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
240 function update_data (h, d) |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
241 x = get (h, "xdata"); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
242 y = get (h, "ydata"); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
243 |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
244 nr = length (x); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
245 len = 2 * nr - 1; |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
246 xs = ys = zeros (1, len); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
247 |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
248 xs(1) = x(1); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
249 ys(1) = y(1); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
250 |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
251 xtmp = x(2:nr); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
252 ridx = 2:2:len-1; |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
253 xs(ridx) = xtmp; |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
254 ys(ridx) = y(1:nr-1); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
255 |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
256 ridx = 3:2:len; |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
257 xs(ridx) = xtmp; |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
258 ys(ridx) = y(2:nr); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
259 |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
260 set (get (h, "children"), "xdata", xs, "ydata", ys); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7746
diff
changeset
|
261 endfunction |