annotate scripts/plot/private/__stem__.m @ 17080:58d3fba6df17

__stem__.m: Fix typo in set() command. * scripts/plot/private/__stem__.m: Add missing "nextplot" argument to set() command.
author Rik <rik@octave.org>
date Thu, 25 Jul 2013 10:42:07 -0700
parents b2cbf369837e
children 87ba70043bfc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 11589
diff changeset
1 ## Copyright (C) 2006-2012 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] = ...
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
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
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
40 oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
41 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
42 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
43 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
44 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
45
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
46 h = [];
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
47 nx = rows (x);
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
48 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
49 if (have_z)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
50 xt = x(:)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
51 xt = [xt; xt; NaN(1, nx)](:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
52 yt = y(:)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
53 yt = [yt; yt; NaN(1, nx)](:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
54 zt = z(:)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
55 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
56 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
57 xt = x(:, i)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
58 xt = [xt; xt; NaN(1, nx)](:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
59 yt = y(:, i)';
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
60 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
61 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
62
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
63 hg = hggroup ();
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
64 h = [h; hg];
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
65 args = __add_datasource__ (caller, hg, {"x", "y", "z"}, varargin{:});
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
66
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
67 if (isempty (llc))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
68 lc = __next_line_color__ ();
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
69 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
70 lc = llc;
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
71 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
72
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
73 if (isempty (mmc))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
74 mc = lc;
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
75 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
76 mc = mmc;
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
77 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
78
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
79 if (dofill)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
80 fc = mc;
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
81 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
82 fc = "none";
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
83 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
84
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
85 if (have_z)
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
86 h_stems = plot3 (hax, xt, yt, zt, "color", lc, "linestyle", ls,
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
87 "parent", hg, x, y, z, "color", mc,
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
88 "marker", ms, "linestyle", "none",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
89 "markerfacecolor", fc, "parent", hg);
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
90
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
91 h_baseline = [];
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
92 else
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
93 h_stems = plot (hax, xt, yt, "color", lc, "linestyle", ls,
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
94 "parent", hg, x(:,i), y(:, i), "color", mc, "marker",
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
95 ms, "linestyle", "none", "markerfacecolor",
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
96 fc, "parent", hg);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
97
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
98 x_axis_range = get (hax, "xlim");
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
99 h_baseline = line (hax, x_axis_range, [0, 0], "color", [0, 0, 0]);
11313
988d2bd6bacd __stem__.m: Each stem hggroup should have its own baseline.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
100 set (h_baseline, "handlevisibility", "off");
988d2bd6bacd __stem__.m: Each stem hggroup should have its own baseline.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
101 set (h_baseline, "xliminclude", "off");
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
102 addlistener (hax, "xlim", @update_xlim);
11313
988d2bd6bacd __stem__.m: Each stem hggroup should have its own baseline.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
103 addlistener (h_baseline, "ydata", @update_baseline);
988d2bd6bacd __stem__.m: Each stem hggroup should have its own baseline.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
104 addlistener (h_baseline, "visible", @update_baseline);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
105 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
106
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
107 ## 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
108 addproperty ("showbaseline", hg, "radio", "{on}|off");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
109 addproperty ("basevalue", hg, "data", 0);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
110 addproperty ("baseline", hg, "data", h_baseline);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
111
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
112 if (! have_z)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
113 addlistener (hg, "showbaseline", @show_baseline);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
114 addlistener (hg, "basevalue", @move_baseline);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
115 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
116
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
117 addproperty ("color", hg, "linecolor", lc);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
118 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
119 addproperty ("linestyle", hg, "linelinestyle", ls);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
120 addproperty ("marker", hg, "linemarker", ms);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
121 addproperty ("markerfacecolor", hg, "linemarkerfacecolor", fc);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
122 addproperty ("markersize", hg, "linemarkersize", 6);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
123
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
124 addlistener (hg, "color", @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, "linestyle", @update_props);
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
127 addlistener (hg, "marker", @update_props);
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
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
131 addproperty ("xdata", hg, "data", x(:, i));
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
132 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
133 if (have_z)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
134 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
135 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
136 addproperty ("zdata", hg, "data", []);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
137 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
138
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
139 addlistener (hg, "xdata", @update_data);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
140 addlistener (hg, "ydata", @update_data);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
141 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
142
8079
082fa7859574 Additional do not call set with empty arguments fixes
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
143 if (! isempty (args))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
144 set (hg, args{:});
8079
082fa7859574 Additional do not call set with empty arguments fixes
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
145 endif
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
146 if (i == 1 && ! isempty (h_baseline))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
147 set (h_baseline, "parent", get (hg, "parent"));
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 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
149 endfor
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
150
17067
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
151 if (! strcmp (hold_state, "add") && have_z)
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
152 set (hax, "view", [-37.5 30]); # 3D view
b2cbf369837e stem.m, stem3.m, __stem__.m: Upgrade to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16751
diff changeset
153 endif
17080
58d3fba6df17 __stem__.m: Fix typo in set() command.
Rik <rik@octave.org>
parents: 17067
diff changeset
154 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
155
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
156 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
157 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
158 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
159 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
160 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
161
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
162 endfunction
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
163
8070
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
164 function [x, y, z, dofill, lc, ls, mc, ms, newargs] = check_stem_arg (have_z, varargin)
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
165
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
166 ## FIXME -- there seems to be a lot of duplicated code in this
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
167 ## function. It seems like it should be possible to simplify things
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
168 ## by combining some of the nearly identical code sections into
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
169 ## additional subfunctions.
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
170
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
171 if (have_z)
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
172 caller = "stem3";
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
173 else
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
174 caller = "stem";
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
175 endif
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
176
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
177 ## Remove prop/val pairs from data to consider.
8070
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
178 i = 2;
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
179 newargs = {};
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
180 while (i < length (varargin))
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
181 if (ischar (varargin{i}) && !(strcmpi ("fill", varargin{i})
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
182 || strcmpi ("filled", varargin{i})))
8070
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
183 newargs{end + 1} = varargin{i};
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
184 newargs{end + 1} = varargin{i + 1};
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
185 nargin = nargin - 2;
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
186 varargin(i:i+1) = [];
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
187 else
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
188 i++;
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
189 endif
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
190 endwhile
3b53b25e2550 Add data sources and line series
David Bateman <dbateman@free.fr>
parents: 8056
diff changeset
191
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
192 ## set specifiers to default values.
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
193 [lc, ls, mc, ms] = set_default_values ();
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
194 dofill = 0;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
195 fill_2 = 0;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
196 linespec_2 = 0;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
197 z = [];
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
198
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
199 ## Check input arguments.
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
200 if (nargin == 2)
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
201 if (have_z)
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
202 z = varargin{1};
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
203 x = 1:rows (z);
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
204 y = 1:columns (z);
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
205 else
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
206 y = varargin{1};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
207 if (isvector (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
208 x = 1:length (y);
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
209 elseif (ismatrix (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
210 x = 1:rows (y);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
211 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
212 error ("stem: Y must be a matrix");
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
213 endif # in each case, x & y will be defined
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
214 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
215 elseif (nargin == 3)
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
216 ## Several possibilities
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
217 ##
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
218 ## 1. the real y data
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
219 ## 2. 'filled'
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
220 ## 3. line spec
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
221 if (ischar (varargin{2}))
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
222 ## Only 2. or 3. possible.
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
223 if (strcmpi ("fill", varargin{2}) || strcmpi ("filled", varargin{2}))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
224 dofill = 1;
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
225 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
226 ## Parse the linespec.
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
227 [lc, ls, mc, ms] = stem_line_spec (caller, varargin{2});
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
228 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
229 if (have_z)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
230 z = varargin{1};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
231 x = 1:rows (z);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
232 y = 1:columns (z);
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
233 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
234 y = varargin{1};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
235 if (isvector (y))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
236 x = 1:length (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
237 elseif (ismatrix (y))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
238 x = 1:rows (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
239 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
240 error ("stem: Y must be a matrix");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
241 endif # in each case, x & y will be defined
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
242 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
243 else
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
244 if (have_z)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
245 error ("stem3: must define X, Y and Z");
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
246 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
247 ## Must be the real y data.
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
248 x = varargin{1};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
249 y = varargin{2};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
250 if (! (ismatrix (x) && ismatrix (y)))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
251 error ("stem: X and Y must be matrices");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
252 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
253 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
254 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
255 elseif (nargin == 4)
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
256 ## Again, several possibilities:
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
257 ##
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
258 ## arg2 1. real y
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
259 ## arg2 2. 'filled' or linespec
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
260 ## arg3 1. real z
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
261 ## arg3 2. 'filled' or linespec
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
262 if (ischar (varargin{2}))
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
263 ## Only arg2 2. / arg3 1. & arg3 3. are possible.
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
264 if (strcmpi ("fill", varargin{2}) || strcmpi ("filled", varargin{2}))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
265 dofill = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
266 fill_2 = 1; # Be sure, no second "fill" is in the arguments.
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
267 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
268 ## Must be a linespec.
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
269 [lc, ls, mc, ms] = stem_line_spec (caller, varargin{2});
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
270 linespec_2 = 1;
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
271 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
272 if (have_z)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
273 z = varargin{1};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
274 x = 1:rows (z);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
275 y = 1:columns (z);
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
276 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
277 y = varargin{1};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
278 if (isvector (y))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
279 x = 1:length (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
280 elseif (ismatrix (y))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
281 x = 1:rows (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
282 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
283 error ("stem: Y must be a matrix");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
284 endif # in each case, x & y will be defined
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
285 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
286 else
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
287 if (have_z)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
288 x = varargin{1};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
289 y = varargin{2};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
290 z = varargin{3};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
291 if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
292 error ("stem3: X, Y and Z must be matrices");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
293 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
294 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
295 ## must be the real y data.
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
296 x = varargin{1};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
297 y = varargin{2};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
298 if (! (ismatrix (x) && ismatrix (y)))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
299 error ("stem: X and Y must be matrices");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
300 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
301 endif
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
302 endif # if ischar (varargin{2})
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
303 if (! have_z)
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
304 ## varargin{3} must be char.
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
305 ## Check for "fill.
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
306 if ((strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
307 && fill_2)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
308 error ("stem: duplicate fill argument");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
309 elseif (strcmpi ("fill", varargin{3}) && linespec_2)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
310 ## Must be "fill".
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
311 dofill = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
312 fill_2 = 1;
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
313 elseif ((strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
314 && !linespec_2)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
315 ## Must be "fill".
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
316 dofill = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
317 fill_2 = 1;
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
318 elseif (! linespec_2)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
319 ## Must be linespec.
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
320 [lc, ls, mc, ms] = stem_line_spec (caller, varargin{3});
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
321 linespec_2 = 1;
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
322 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
323 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
324 elseif (nargin == 5)
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
325 if (have_z)
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
326 x = varargin{1};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
327 y = varargin{2};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
328 z = varargin{3};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
329 if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
330 error ("stem3: X, Y and Z must be matrices");
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
331 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
332 else
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
333 x = varargin{1};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
334 y = varargin{2};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
335 if (! (ismatrix (x) && ismatrix (y)))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
336 error ("stem: X and Y must be matrices");
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
337 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
338 endif
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 if (! have_z)
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
341 if (strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
342 dofill = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
343 fill_2 = 1; # Be sure, no second "fill" is in the arguments.
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
344 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
345 ## Must be a linespec.
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
346 [lc, ls, mc, ms] = stem_line_spec (caller, varargin{3});
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
347 linespec_2 = 1;
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
348 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
349 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
350
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
351 ## Check for "fill".
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
352 if ((strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
353 && fill_2)
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
354 error ("%s: duplicate fill argument", caller);
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
355 elseif ((strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
356 && linespec_2)
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
357 ## Must be "fill".
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
358 dofill = 1;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
359 fill_2 = 1;
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
360 elseif (!strcmpi (varargin{4}, "fill") && !strcmpi (varargin{4}, "filled")
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
361 && !linespec_2)
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
362 ## Must be linespec.
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
363 [lc, ls, mc, ms] = stem_line_spec (caller, varargin{4});
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
364 linespec_2 = 1;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
365 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
366 elseif (nargin == 6 && have_z)
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
367 x = varargin{1};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
368 y = varargin{2};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
369 z = varargin{3};
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
370 if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
371 error ("stem3: X, Y and Z must be matrices");
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
372 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
373
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
374 if (strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled"))
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
375 dofill = 1;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
376 fill_2 = 1; # be sure, no second "fill" is in the arguments
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
377 else
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
378 ## Must be a linespec.
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
379 [lc, ls, mc, ms] = stem_line_spec (caller, varargin{4});
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
380 linespec_2 = 1;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
381 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
382
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
383 ## check for "fill" ..
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
384 if ((strcmpi (varargin{5}, "fill") || strcmpi (varargin{5}, "filled"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
385 && fill_2)
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
386 error ("stem3: duplicate fill argument");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
387 elseif ((strcmpi (varargin{5}, "fill") || strcmpi (varargin{5}, "filled"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
388 && linespec_2)
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
389 ## Must be "fill".
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
390 dofill = 1;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
391 fill_2 = 1;
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
392 elseif (!strcmpi (varargin{5}, "fill") && !strcmpi (varargin{5}, "filled")
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
393 && !linespec_2)
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
394 ## Must be linespec.
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
395 [lc, ls, mc, ms] = stem_line_spec (caller, varargin{5});
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
396 linespec_2 = 1;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
397 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
398 else
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
399 error ("%s: incorrect number of arguments", caller);
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
400 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
401
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8315
diff changeset
402 ## 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
403 if (have_z)
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
404 if (!size_equal (x, y, z))
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
405 error ("stem3: inconsistent size of x, y and z");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
406 else
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
407 x = x(:);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
408 y = y(:);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
409 z = z(:);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
410 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
411 else
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
412 if (isvector (x))
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
413 x = x(:);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
414 if (isvector (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
415 if (length (x) != length (y))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
416 error ("stem: inconsistent size of x and y");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
417 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
418 y = y(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
419 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
420 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
421 if (length (x) == rows (y))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
422 x = repmat (x(:), 1, columns (y));
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
423 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
424 error ("stem: inconsistent size of x and y");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
425 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
426 endif
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
427 elseif (!size_equal (x, y))
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
428 error ("stem: inconsistent size of x and y");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
429 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
430 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
431
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
432 endfunction
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
433
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
434 function [lc, ls, mc, ms] = stem_line_spec (caller, str)
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
435 if (! ischar (str))
7218
02eb1619b857 [project @ 2007-11-29 21:10:55 by jwe]
jwe
parents: 7217
diff changeset
436 error ("%s: expecting argument to be \"fill\" or a string of specifiers",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
437 caller);
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
438 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
439 [lc, ls, mc, ms] = set_default_values ();
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
440 ## Parse the line specifier string.
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
441 cur_props = __pltopt__ ("stem", str, false);
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
442 for i = 1:length (cur_props)
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
443 if (isfield (cur_props(i), "color") && ! isempty (cur_props(i).color)); # means line color
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
444 mc = lc = cur_props(i).color;
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
445 elseif (isfield (cur_props(i), "linestyle"))
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
446 ls = cur_props(i).linestyle;
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9896
diff changeset
447 if (isempty (ls))
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9896
diff changeset
448 ls = __next_line_style__ ();
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9896
diff changeset
449 endif
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
450 elseif (isfield (cur_props(i), "marker") && ! strcmpi (cur_props(i).marker, "none"))
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
451 ms = cur_props(i).marker;
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9896
diff changeset
452 if (isempty (ms))
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9896
diff changeset
453 [dummy, ms] = __next_line_style__ ();
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9896
diff changeset
454 endif
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
455 endif
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
456 endfor
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
457 endfunction
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
458
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
459 function [lc, ls, mc, ms] = set_default_values ()
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
460 ## set default values
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
461 mc = [];
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
462 lc = [];
7217
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
463 ls = "-";
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
464 ms = "o";
c8abc18322b7 [project @ 2007-11-29 20:50:24 by jwe]
jwe
parents:
diff changeset
465 endfunction
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
466
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
467 function update_xlim (h, d)
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
468 kids = get (h, "children");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
469 xlim = get (h, "xlim");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
470
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
471 for i = 1 : length (kids)
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
472 obj = get (kids (i));
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
473 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
474 if (any (get (obj.baseline, "xdata") != xlim))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
475 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
476 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
477 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
478 endfor
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
479 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
480
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
481 function update_baseline (h, d)
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
482 visible = get (h, "visible");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
483 ydata = get (h, "ydata")(1);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
484
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
485 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
486 for i = 1 : length (kids)
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
487 obj = get (kids (i));
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
488 if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
489 && obj.baseline == h)
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
490 ## Only alter if changed to avoid recursion of the listener functions
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
491 if (! strcmpi (get (kids(i), "showbaseline"), visible))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
492 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
493 endif
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8079
diff changeset
494 if (! strcmpi (get (kids(i), "basevalue"), visible))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
495 set (kids (i), "basevalue", ydata);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
496 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
497 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
498 endfor
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
499 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
500
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
501 function show_baseline (h, d)
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
502 set (get (h, "baseline"), "visible", get (h, "showbaseline"));
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
503 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
504
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
505 function move_baseline (h, d)
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
506 b0 = get (h, "basevalue");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
507 bl = get (h, "baseline");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
508
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
509 if (get (bl, "ydata") != [b0, b0])
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
510 set (bl, "ydata", [b0, b0]);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
511 endif
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
512
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
513 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
514 yt = get (h, "ydata")(:)';
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
515 ny = length (yt);
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
516 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
517 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
518 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
519
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
520 function update_props (h, d)
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
521 kids = get (h, "children");
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
522 set (kids(2), "color", get (h, "color"),
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
523 "linewidth", get (h, "linewidth"),
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
524 "linestyle", get (h, "linestyle"));
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
525 set (kids(1), "color", get (h, "color"),
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
526 "marker", get (h, "marker"),
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
527 "markerfacecolor", get (h, "markerfacecolor"),
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
528 "markersize", get (h, "markersize"));
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
529 endfunction
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
530
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
531 function update_data (h, d)
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
532 x = get (h, "xdata");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
533 y = get (h, "ydata");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
534 z = get (h, "zdata");
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
535
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
536 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
537 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
538 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
539 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
540 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
541 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
542 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
543 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
544 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
545 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
546 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
547 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
548 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
549 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
550 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
551 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
552 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
553 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
554 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
555 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
556 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
557 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
558 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
559 endif
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 7218
diff changeset
560
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
561 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
562 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
563 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
564 endfunction