annotate scripts/plot/draw/private/__stem__.m @ 19631:db92e7e28e1f

strip trailing whitespace from most source files * NEWS, doc/interpreter/contributors.in, doc/interpreter/func.txi, doc/interpreter/genpropdoc.m, doc/interpreter/octave_logo.eps, doc/interpreter/plot.txi, doc/interpreter/stmt.txi, examples/data/Makefile.am, libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc, libinterp/corefcn/error.cc, libinterp/corefcn/file-io.cc, libinterp/corefcn/gl-render.cc, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/load-path.cc, libinterp/corefcn/pr-output.cc, libinterp/corefcn/pt-jit.cc, libinterp/corefcn/strfind.cc, libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h, libinterp/corefcn/urlwrite.cc, libinterp/corefcn/variables.cc, libinterp/octave-value/ov-classdef.cc, libinterp/octave-value/ov-classdef.h, libinterp/octave.cc, libinterp/parse-tree/lex.h, libinterp/parse-tree/oct-parse.in.yy, libinterp/parse-tree/pt-classdef.h, liboctave/system/file-ops.cc, liboctave/system/oct-env.cc, m4/acinclude.m4, scripts/deprecated/finite.m, scripts/deprecated/fmod.m, scripts/deprecated/fnmatch.m, scripts/deprecated/luinc.m, scripts/deprecated/octave_tmp_file_name.m, scripts/deprecated/syl.m, scripts/deprecated/usage.m, scripts/general/inputParser.m, scripts/general/interp1.m, scripts/general/interp2.m, scripts/general/interp3.m, scripts/general/isequal.m, scripts/general/private/__isequal__.m, scripts/geometry/voronoi.m, scripts/image/image.m, scripts/image/imshow.m, scripts/image/ind2rgb.m, scripts/linear-algebra/bandwidth.m, scripts/linear-algebra/isbanded.m, scripts/miscellaneous/bzip2.m, scripts/miscellaneous/cast.m, scripts/miscellaneous/copyfile.m, scripts/miscellaneous/delete.m, scripts/miscellaneous/fullfile.m, scripts/miscellaneous/getappdata.m, scripts/miscellaneous/gunzip.m, scripts/miscellaneous/isappdata.m, scripts/miscellaneous/ls.m, scripts/miscellaneous/mex.m, scripts/miscellaneous/movefile.m, scripts/miscellaneous/orderfields.m, scripts/miscellaneous/recycle.m, scripts/miscellaneous/rmappdata.m, scripts/miscellaneous/setfield.m, scripts/miscellaneous/symvar.m, scripts/miscellaneous/tar.m, scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unpack.m, scripts/miscellaneous/ver.m, scripts/miscellaneous/what.m, scripts/miscellaneous/xor.m, scripts/miscellaneous/zip.m, scripts/optimization/fminbnd.m, scripts/optimization/sqp.m, scripts/path/private/getsavepath.m, scripts/path/savepath.m, scripts/pkg/pkg.m, scripts/pkg/private/installed_packages.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m, scripts/plot/draw/private/__quiver__.m, scripts/plot/draw/private/__scatter__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfnorm.m, scripts/plot/util/copyobj.m, scripts/plot/util/hgload.m, scripts/plot/util/hgsave.m, scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m, scripts/plot/util/private/__go_draw_axes__.m, scripts/set/setdiff.m, scripts/set/union.m, scripts/signal/periodogram.m, scripts/sparse/eigs.m, scripts/sparse/ilu.m, scripts/sparse/qmr.m, scripts/sparse/sprand.m, scripts/sparse/sprandn.m, scripts/specfun/beta.m, scripts/specfun/ellipke.m, scripts/specfun/isprime.m, scripts/statistics/base/lscov.m, scripts/testfun/__run_test_suite__.m, scripts/testfun/test.m: Strip trailing whitespace.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 10:29:54 -0500
parents 0e1f5a750d00
children 4197fc428c7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17572
diff changeset
1 ## Copyright (C) 2006-2013 Michel D. Schmid
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
2 ##
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
4 ##
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
9 ##
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
14 ##
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
18
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8507
diff changeset
19 ## -*- texinfo -*-
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8507
diff changeset
20 ## @deftypefn {Function File} {@var{h} =} __stem__ (@var{have_z}, @var{varargin})
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8507
diff changeset
21 ## Undocumented internal function.
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8507
diff changeset
22 ## @end deftypefn
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
23
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
24 ## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
25 ## Adapted-by: jwe
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
26
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
27 function h = __stem__ (have_z, varargin)
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
28
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
29 if (have_z)
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
30 caller = "stem3";
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
31 else
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
32 caller = "stem";
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
33 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
34
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
35 [hax, varargin, nargin] = __plt_get_axis_arg__ (caller, varargin{:});
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
36
8070
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
37 [x, y, z, dofill, llc, ls, mmc, ms, varargin] = ...
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
38 check_stem_arg (have_z, varargin{:});
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
39
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17080
diff changeset
40 oldfig = [];
17301
68bcac3c043a Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents: 17211
diff changeset
41 if (! isempty (hax))
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17080
diff changeset
42 oldfig = get (0, "currentfigure");
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17080
diff changeset
43 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
44 unwind_protect
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
45 hax = newplot (hax);
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
46 hold_state = get (hax, "nextplot");
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
47 set (hax, "nextplot", "add");
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
48
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
49 h = [];
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
50 nx = rows (x);
18463
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
51 h_baseline = [];
19631
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19630
diff changeset
52
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
53 for i = 1 : columns (x)
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
54 if (have_z)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
55 xt = x(:)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
56 xt = [xt; xt; NaN(1, nx)](:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
57 yt = y(:)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
58 yt = [yt; yt; NaN(1, nx)](:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
59 zt = z(:)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
60 zt = [zeros(1, nx); zt; NaN(1, nx)](:);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
61 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
62 xt = x(:, i)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
63 xt = [xt; xt; NaN(1, nx)](:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
64 yt = y(:, i)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
65 yt = [zeros(1, nx); yt; NaN(1, nx)](:);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
66 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
67
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
68 if (isempty (llc))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
69 lc = __next_line_color__ ();
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
70 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
71 lc = llc;
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
72 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
73
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
74 if (isempty (mmc))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
75 mc = lc;
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
76 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
77 mc = mmc;
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
78 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
79
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
80 if (dofill)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
81 fc = mc;
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
82 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
83 fc = "none";
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
84 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
85
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
86 ## Must occur after __next_line_color__ in order to work correctly.
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
87 hg = hggroup ();
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
88 h = [h; hg];
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
89 args = __add_datasource__ (caller, hg, {"x", "y", "z"}, varargin{:});
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
90
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
91 if (have_z)
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
92 __line__ (hax, xt, yt, zt, "color", lc, "linestyle", ls, "parent", hg);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
93 __line__ (hax, x, y, z, "color", mc, "linestyle", "none",
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
94 "marker", ms, "markerfacecolor", fc, "parent", hg);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
95 else
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
96 __line__ (hax, xt, yt, "color", lc, "linestyle", ls, "parent", hg);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
97 __line__ (hax, x(:,i), y(:, i), "color", mc, "linestyle", "none",
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
98 "marker", ms, "markerfacecolor", fc, "parent", hg);
19631
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19630
diff changeset
99
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
100 x_axis_range = get (hax, "xlim");
18463
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
101 if (isempty (h_baseline))
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
102 h_baseline = line (hax, x_axis_range, [0, 0], "color", [0, 0, 0]);
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
103 set (h_baseline, "handlevisibility", "off", "xliminclude", "off");
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
104 addproperty ("basevalue", h_baseline, "data", 0);
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
105 else
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
106 set (h_baseline, "xdata", x_axis_range);
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
107 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
108 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
109
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
110 ## Setup the hggroup and listeners.
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
111 addproperty ("showbaseline", hg, "radio", "{on}|off");
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
112 addproperty ("baseline", hg, "data", h_baseline);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
113 addproperty ("basevalue", hg, "data", 0);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
114
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
115 addproperty ("color", hg, "linecolor", lc);
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
116 addproperty ("linestyle", hg, "linelinestyle", ls);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
117 addproperty ("linewidth", hg, "linelinewidth", 0.5);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
118 addproperty ("marker", hg, "linemarker", ms);
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
119 addproperty ("markeredgecolor", hg, "linemarkerfacecolor", mc);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
120 addproperty ("markerfacecolor", hg, "linemarkerfacecolor", fc);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
121 addproperty ("markersize", hg, "linemarkersize", 6);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
122
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
123 addlistener (hg, "color", @update_props);
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
124 addlistener (hg, "linestyle", @update_props);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
125 addlistener (hg, "linewidth", @update_props);
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
126 addlistener (hg, "marker", @update_props);
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
127 addlistener (hg, "markeredgecolor", @update_props);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
128 addlistener (hg, "markerfacecolor", @update_props);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
129 addlistener (hg, "markersize", @update_props);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
130
19423
aea099cd1ee7 Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents: 18463
diff changeset
131 if (islogical (x))
aea099cd1ee7 Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents: 18463
diff changeset
132 x = double (x);
aea099cd1ee7 Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents: 18463
diff changeset
133 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
134 addproperty ("xdata", hg, "data", x(:, i));
19423
aea099cd1ee7 Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents: 18463
diff changeset
135 if (islogical (y))
aea099cd1ee7 Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents: 18463
diff changeset
136 y = double (y);
aea099cd1ee7 Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents: 18463
diff changeset
137 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
138 addproperty ("ydata", hg, "data", y(:, i));
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
139 if (have_z)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
140 addproperty ("zdata", hg, "data", z(:, i));
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
141 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
142 addproperty ("zdata", hg, "data", []);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
143 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
144
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
145 addlistener (hg, "xdata", @update_data);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
146 addlistener (hg, "ydata", @update_data);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
147 addlistener (hg, "zdata", @update_data);
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
148
17527
76614e624818 Add "HitTestArea" property to certain hggroups for Matlab compatibility
Rik <rik@octave.org>
parents: 17462
diff changeset
149 ## Matlab property, although Octave does not implement it.
76614e624818 Add "HitTestArea" property to certain hggroups for Matlab compatibility
Rik <rik@octave.org>
parents: 17462
diff changeset
150 addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
76614e624818 Add "HitTestArea" property to certain hggroups for Matlab compatibility
Rik <rik@octave.org>
parents: 17462
diff changeset
151
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
152 endfor
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
153
18463
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
154 ## baseline listeners
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
155 if (! isempty (h_baseline))
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
156 addlistener (hax, "xlim", @update_xlim);
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
157 for hg = h'
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
158 addlistener (hg, "showbaseline", @show_baseline);
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
159 addlistener (hg, "visible", {@show_baseline, h});
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
160 addlistener (hg, "basevalue", @move_baseline);
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
161 endfor
19631
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19630
diff changeset
162
18463
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
163 addlistener (h_baseline, "basevalue", {@update_baseline, 0});
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
164 addlistener (h_baseline, "ydata", {@update_baseline, 1});
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
165 addlistener (h_baseline, "visible", {@update_baseline, 2});
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
166 set (h_baseline, "parent", get (hg(1), "parent"));
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
167 endif
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
168
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
169 ## property/value pairs
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
170 if (! isempty (args))
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
171 set (h, args{:});
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
172 endif
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
173
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
174 if (! strcmp (hold_state, "add") && have_z)
17430
366a51191fd7 __stem__.m: Turn on grid for stem3 plotting for Matlab compatibility.
Rik <rik@octave.org>
parents: 17338
diff changeset
175 set (hax, "view", [-37.5 30],
366a51191fd7 __stem__.m: Turn on grid for stem3 plotting for Matlab compatibility.
Rik <rik@octave.org>
parents: 17338
diff changeset
176 "xgrid", "on", "ygrid", "on", "zgrid", "on");
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
177 endif
17080
58d3fba6df17 __stem__.m: Fix typo in set() command.
Rik <rik@octave.org>
parents: 17067
diff changeset
178 set (hax, "nextplot", hold_state);
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
179
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
180 unwind_protect_cleanup
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
181 if (! isempty (oldfig))
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
182 set (0, "currentfigure", oldfig);
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
183 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
184 end_unwind_protect
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
185
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
186 endfunction
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
187
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
188 function [x, y, z, dofill, lc, ls, mc, ms, args] = check_stem_arg (have_z, varargin)
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
189
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
190 if (have_z)
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
191 caller = "stem3";
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
192 else
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
193 caller = "stem";
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
194 endif
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
195 nargin = nargin - 1; # account for have_z argument
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
196
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
197 num_numeric = find (cellfun ("isclass", varargin, "char"), 1) - 1;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
198 if (isempty (num_numeric))
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
199 num_numeric = nargin;
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
200 endif
8070
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
201
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
202 if (num_numeric < 1 || num_numeric > 3)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
203 print_usage (caller);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
204 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
205
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
206 x = y = z = [];
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
207 if (num_numeric == 1)
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
208 if (have_z)
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
209 z = varargin{1};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
210 else
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
211 y = varargin{1};
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
212 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
213 elseif (num_numeric == 2)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
214 if (have_z)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
215 error ("stem3: must define X, Y, and Z");
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
216 else
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
217 x = varargin{1};
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
218 y = varargin{2};
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
219 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
220 else # nun_numeric == 3
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
221 if (have_z)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
222 x = varargin{1};
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
223 y = varargin{2};
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
224 z = varargin{3};
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
225 else
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
226 error ("stem: can not define Z for 2-D stem plot");
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
227 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
228 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
229
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
230 ## Validate numeric data
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
231 if (have_z)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
232 if (isempty (x))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
233 [nr, nc] = size (z);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
234 if (nr >= nc)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
235 x = repmat ([1:nc], nr, 1);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
236 y = repmat ([1:nr]', 1, nc);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
237 else
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
238 x = repmat ([1:nc], nr, 1);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
239 y = repmat ([1:nr]', 1, nc);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
240 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
241 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
242 if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
243 error ("stem3: X, Y, and Z must be numeric");
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
244 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
245 else
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
246 if (isempty (x))
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
247 if (isvector (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
248 x = 1:length (y);
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
249 elseif (ismatrix (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
250 x = 1:rows (y);
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
251 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
252 endif
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
253 if (! (ismatrix (x) && ismatrix (y)))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
254 error ("stem: X and Y must be numeric");
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
255 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
256 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
257
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
258 ## Check sizes of x, y and z.
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
259 if (have_z)
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
260 if (! size_equal (x, y, z))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
261 error ("stem3: inconsistent sizes for X, Y, and Z");
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
262 endif
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
263 x = x(:);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
264 y = y(:);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
265 z = z(:);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
266 else
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
267 if (isvector (x))
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
268 x = x(:);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
269 if (isvector (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
270 if (length (x) != length (y))
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
271 error ("stem: inconsistent sizes for X and Y");
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
272 endif
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
273 y = y(:);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
274 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
275 if (length (x) == rows (y))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
276 x = repmat (x(:), 1, columns (y));
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
277 else
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
278 error ("stem: inconsistent sizes for X and Y");
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
279 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
280 endif
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
281 elseif (! size_equal (x, y))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
282 error ("stem: inconsistent sizes for X and Y");
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
283 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
284 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
285
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
286 dofill = false;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
287 have_line_spec = false;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
288 ## set specifiers to default values.
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
289 [lc, ls, mc, ms] = set_default_values ();
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
290
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
291 args = {};
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
292 ioff = num_numeric + 1;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
293 while (ioff <= nargin)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
294 arg = varargin{ioff++};
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
295 if (ischar (arg) && any (strcmpi (arg, {"fill", "filled"})))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
296 dofill = true;
17462
177147bf7b55 Overhaul use of __pltopt__.m to correctly check for cellstr, not just cell.
Rik <rik@octave.org>
parents: 17432
diff changeset
297 elseif ((ischar (arg) || iscellstr (arg)) && ! have_line_spec)
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
298 [linespec, valid] = __pltopt__ (caller, arg, false);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
299 if (valid)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
300 have_line_spec = true;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
301 [lc, ls, mc, ms] = stem_line_spec (linespec);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
302 else
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
303 args{end+1} = arg;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
304 if (ioff <= nargin)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
305 args{end+1} = varargin{ioff++};
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
306 else
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
307 error ('%s: No value specified for property "%s"', caller, arg);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
308 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
309 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
310 else
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
311 args{end+1} = arg;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
312 if (ioff <= nargin)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
313 args{end+1} = varargin{ioff++};
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
314 else
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
315 error ('%s: No value specified for property "%s"', caller, arg);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
316 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
317 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
318 endwhile
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
319
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
320 endfunction
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
321
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
322 function [lc, ls, mc, ms] = stem_line_spec (lspec)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
323
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
324 [lc, ls, mc, ms] = set_default_values ();
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
325
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
326 if (! isempty (lspec.color))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
327 lc = mc = lspec.color;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
328 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
329
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
330 if (! isempty (lspec.linestyle) && ! strcmp (lspec.linestyle, "none"))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
331 ls = lspec.linestyle;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
332 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
333
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
334 if (! isempty (lspec.marker) && ! strcmp (lspec.marker, "none"))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
335 ms = lspec.marker;
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
336 endif
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
337
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
338 endfunction
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
339
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
340 function [lc, ls, mc, ms] = set_default_values ()
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
341 mc = [];
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
342 lc = [];
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
343 ls = "-";
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
344 ms = "o";
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
345 endfunction
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
346
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
347 function update_xlim (h, ~)
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
348 kids = get (h, "children");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
349 xlim = get (h, "xlim");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
350
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
351 for i = 1 : length (kids)
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
352 obj = get (kids(i));
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
353 if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline"))
8056
9a6f4713f765 Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents: 8052
diff changeset
354 if (any (get (obj.baseline, "xdata") != xlim))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
355 set (obj.baseline, "xdata", xlim);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
356 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
357 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
358 endfor
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
359 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
360
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
361 function update_baseline (h, ~, src)
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
362 visible = get (h, "visible");
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
363 if (src == 0)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
364 basevalue = get (h, "basevalue");
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
365 else
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
366 basevalue = get (h, "ydata")(1);
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
367 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
368
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
369 kids = get (get (h, "parent"), "children");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
370 for i = 1 : length (kids)
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
371 obj = get (kids(i));
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
372 if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
373 && obj.baseline == h)
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
374 ## Avoid lots of unnecessary listener updates
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
375 if (! strcmp (get (kids(i), "showbaseline"), visible))
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
376 set (kids(i), "showbaseline", visible);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
377 endif
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
378 if (get (kids(i), "basevalue") != basevalue)
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
379 set (kids(i), "basevalue", basevalue);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
380 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
381 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
382 endfor
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
383 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
384
18463
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
385 function show_baseline (h, ~, hg = [])
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
386 if (isempty (hg))
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
387 set (get (h, "baseline"), "visible", get (h, "showbaseline"));
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
388 else
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
389 if (all (strcmp (get (hg, "visible"), "off")))
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
390 set (get (h, "baseline"), "visible", "off");
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
391 else
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
392 set (get (h, "baseline"), "visible", "on");
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
393 endif
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
394 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
395 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
396
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
397 function move_baseline (h, ~)
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
398 b0 = get (h, "basevalue");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
399 bl = get (h, "baseline");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
400
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
401 set (bl, "ydata", [b0, b0]);
18463
2d0afa04d103 Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17744
diff changeset
402 set (bl, "basevalue", b0);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
403
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
404 kids = get (h, "children");
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
405 yt = get (h, "ydata")(:)';
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
406 ny = length (yt);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
407 yt = [b0 * ones(1, ny); yt; NaN(1, ny)](:);
8315
e9687c313d5f Fix callbacks in stem and quiver for change in order of children. Fix for scaling in quiver for single arrow
David Bateman <dbateman@free.fr>
parents: 8238
diff changeset
408 set (kids(2), "ydata", yt);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
409 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
410
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
411 function update_props (h, ~)
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
412 kids = get (h, "children");
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
413 set (kids(2), "color", get (h, "color"),
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
414 "linestyle", get (h, "linestyle"),
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
415 "linewidth", get (h, "linewidth"));
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
416 set (kids(1), "color", get (h, "markeredgecolor"),
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
417 "marker", get (h, "marker"),
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
418 "markerfacecolor", get (h, "markerfacecolor"),
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
419 "markersize", get (h, "markersize"));
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
420 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
421
17432
77bec442a35a Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents: 17430
diff changeset
422 function update_data (h, ~)
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
423 x = get (h, "xdata");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
424 y = get (h, "ydata");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
425 z = get (h, "zdata");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
426
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
427 if (!isempty (z) && size_equal (x, y, z))
16751
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
428 sz = min ([size(x); size(y); size(z)]);
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
429 x = x(1:sz(1),1:sz(2));
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
430 y = y(1:sz(1),1:sz(2));
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
431 z = z(1:sz(1),1:sz(2));
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
432 elseif (numel (x) != numel (y));
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
433 sz = min ([size(x); size(y)]);
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
434 x = x(1:sz(1),1:sz(2));
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
435 y = y(1:sz(1),1:sz(2));
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
436 endif
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
437 bl = get (h, "basevalue");
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
438 nx = numel (x);
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
439 x = x(:)';
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
440 xt = [x; x; NaN(1, nx)](:);
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
441 if (! isempty (z))
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
442 y = y(:)';
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
443 yt = [y; y; NaN(1, nx)](:);
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
444 z = z(:)';
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
445 zt = [bl * ones(1, nx); z; NaN(1, nx)](:);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
446 else
16751
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
447 y = y(:)';
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
448 yt = [bl * ones(1, nx); y; NaN(1, nx)](:);
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
449 zt = [];
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
450 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
451
16751
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
452 kids = get (h, "children");
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
453 set (kids(2), "xdata", xt, "ydata", yt, "zdata", zt);
92811d110839 Update copies consistent subset of {x,y,z}data to children of the stem hggoup.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
454 set (kids(1), "xdata", x, "ydata", y, "zdata", z);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
455 endfunction
17338
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 17301
diff changeset
456