Mercurial > hg > octave-nkf
annotate scripts/plot/draw/private/__stem__.m @ 20496:42b7d7758c4a
Remove axes "interpreter" property (bug #45388)
* graphics.in.h (axes::properties): remove interpreter property
* genpropdoc.m: remove "interpreter" from the list of axes properties
* legend.m: create legend axes specific "interpreter" property
* polar.m: bind labels "interpreter" to the axes "ticklabelinterpreter"
* cla.m: use "ticklabelinterpreter" in test
* __go_draw_axes__.m: use "ticklabelinterpreter" property for axes objects
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Thu, 25 Jun 2015 00:22:32 +0200 |
parents | 83792dd9bcc1 |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19794
diff
changeset
|
1 ## Copyright (C) 2006-2015 Michel D. Schmid |
7217 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
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 | 23 |
24 ## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net> | |
25 ## Adapted-by: jwe | |
26 | |
27 function h = __stem__ (have_z, varargin) | |
28 | |
7218 | 29 if (have_z) |
30 caller = "stem3"; | |
31 else | |
32 caller = "stem"; | |
33 endif | |
7217 | 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 | 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 | 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 | 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); |
18531
2d0afa04d103
Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
51 h_baseline = []; |
19794
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19793
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 | 55 xt = x(:)'; |
56 xt = [xt; xt; NaN(1, nx)](:); | |
57 yt = y(:)'; | |
58 yt = [yt; yt; NaN(1, nx)](:); | |
59 zt = z(:)'; | |
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 | 62 xt = x(:, i)'; |
63 xt = [xt; xt; NaN(1, nx)](:); | |
64 yt = y(:, i)'; | |
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 | 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 | 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 | 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 | 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 | 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 | 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); |
19794
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19793
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"); |
18531
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 | 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 |
19584
aea099cd1ee7
Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents:
18531
diff
changeset
|
131 if (islogical (x)) |
aea099cd1ee7
Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents:
18531
diff
changeset
|
132 x = double (x); |
aea099cd1ee7
Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents:
18531
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)); |
19584
aea099cd1ee7
Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents:
18531
diff
changeset
|
135 if (islogical (y)) |
aea099cd1ee7
Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents:
18531
diff
changeset
|
136 y = double (y); |
aea099cd1ee7
Allow stem to plot logical values (bug #43391).
Markus Bergholz <markuman+octave@gmail.com>
parents:
18531
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 | 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 | 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 |
18531
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 |
19794
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19793
diff
changeset
|
162 |
18531
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 | 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 | 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 | 186 endfunction |
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 | 189 |
7218 | 190 if (have_z) |
191 caller = "stem3"; | |
192 else | |
193 caller = "stem"; | |
194 endif | |
20441
83792dd9bcc1
Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents:
20204
diff
changeset
|
195 nargin = nargin () - 1; # account for have_z argument |
7218 | 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)) |
19790
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 | 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 | 208 if (have_z) |
209 z = varargin{1}; | |
210 else | |
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 |
20204
185e8dbdaa40
Allow logical arguments to stem() function (bug #44659).
Rik <rik@octave.org>
parents:
20038
diff
changeset
|
242 if (! (isnumeric (x) || islogical (x)) |
185e8dbdaa40
Allow logical arguments to stem() function (bug #44659).
Rik <rik@octave.org>
parents:
20038
diff
changeset
|
243 || ! (isnumeric (y) || islogical (y)) |
185e8dbdaa40
Allow logical arguments to stem() function (bug #44659).
Rik <rik@octave.org>
parents:
20038
diff
changeset
|
244 || ! (isnumeric (z) || islogical (z))) |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
245 error ("stem3: X, Y, and Z must be numeric"); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
246 endif |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
247 else |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
248 if (isempty (x)) |
7217 | 249 if (isvector (y)) |
10549 | 250 x = 1:length (y); |
7217 | 251 elseif (ismatrix (y)) |
10549 | 252 x = 1:rows (y); |
7217 | 253 endif |
254 endif | |
20204
185e8dbdaa40
Allow logical arguments to stem() function (bug #44659).
Rik <rik@octave.org>
parents:
20038
diff
changeset
|
255 if (! (isnumeric (x) || islogical (x)) |
185e8dbdaa40
Allow logical arguments to stem() function (bug #44659).
Rik <rik@octave.org>
parents:
20038
diff
changeset
|
256 || ! (isnumeric (y) || islogical (y))) |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
257 error ("stem: X and Y must be numeric"); |
7217 | 258 endif |
259 endif | |
260 | |
8506 | 261 ## 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
|
262 if (have_z) |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
263 if (! size_equal (x, y, z)) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
264 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
|
265 endif |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
266 x = x(:); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
267 y = y(:); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
268 z = z(:); |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
269 else |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
270 if (isvector (x)) |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
271 x = x(:); |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
272 if (isvector (y)) |
10549 | 273 if (length (x) != length (y)) |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
274 error ("stem: inconsistent sizes for X and Y"); |
10549 | 275 endif |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
276 y = y(:); |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
277 else |
10549 | 278 if (length (x) == rows (y)) |
279 x = repmat (x(:), 1, columns (y)); | |
280 else | |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
281 error ("stem: inconsistent sizes for X and Y"); |
10549 | 282 endif |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
283 endif |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
284 elseif (! size_equal (x, y)) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
285 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
|
286 endif |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
287 endif |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
288 |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
289 dofill = false; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
290 have_line_spec = false; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
291 ## set specifiers to default values. |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
292 [lc, ls, mc, ms] = set_default_values (); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
293 |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
294 args = {}; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
295 ioff = num_numeric + 1; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
296 while (ioff <= nargin) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
297 arg = varargin{ioff++}; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
298 if (ischar (arg) && any (strcmpi (arg, {"fill", "filled"}))) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
299 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
|
300 elseif ((ischar (arg) || iscellstr (arg)) && ! have_line_spec) |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
301 [linespec, valid] = __pltopt__ (caller, arg, false); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
302 if (valid) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
303 have_line_spec = true; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
304 [lc, ls, mc, ms] = stem_line_spec (linespec); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
305 else |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
306 args{end+1} = arg; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
307 if (ioff <= nargin) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
308 args{end+1} = varargin{ioff++}; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
309 else |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
310 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
|
311 endif |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
312 endif |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
313 else |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
314 args{end+1} = arg; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
315 if (ioff <= nargin) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
316 args{end+1} = varargin{ioff++}; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
317 else |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
318 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
|
319 endif |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
320 endif |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
321 endwhile |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
322 |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
323 endfunction |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
324 |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
325 function [lc, ls, mc, ms] = stem_line_spec (lspec) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
326 |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
327 [lc, ls, mc, ms] = set_default_values (); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
328 |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
329 if (! isempty (lspec.color)) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
330 lc = mc = lspec.color; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
331 endif |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
332 |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
333 if (! isempty (lspec.linestyle) && ! strcmp (lspec.linestyle, "none")) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
334 ls = lspec.linestyle; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
335 endif |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
336 |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
337 if (! isempty (lspec.marker) && ! strcmp (lspec.marker, "none")) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
338 ms = lspec.marker; |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
339 endif |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
340 |
7217 | 341 endfunction |
342 | |
343 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
|
344 mc = []; |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
345 lc = []; |
7217 | 346 ls = "-"; |
347 ms = "o"; | |
348 endfunction | |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
349 |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
350 function update_xlim (h, ~) |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
351 kids = get (h, "children"); |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
352 xlim = get (h, "xlim"); |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
353 |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
354 for i = 1 : length (kids) |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
355 obj = get (kids(i)); |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
356 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
|
357 if (any (get (obj.baseline, "xdata") != xlim)) |
10549 | 358 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
|
359 endif |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
360 endif |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
361 endfor |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
362 endfunction |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
363 |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
364 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
|
365 visible = get (h, "visible"); |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
366 if (src == 0) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
367 basevalue = get (h, "basevalue"); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
368 else |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
369 basevalue = get (h, "ydata")(1); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
370 endif |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
371 |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
372 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
|
373 for i = 1 : length (kids) |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
374 obj = get (kids(i)); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
375 if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline") |
10549 | 376 && obj.baseline == h) |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
377 ## Avoid lots of unnecessary listener updates |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
378 if (! strcmp (get (kids(i), "showbaseline"), visible)) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
379 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
|
380 endif |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
381 if (get (kids(i), "basevalue") != basevalue) |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
382 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
|
383 endif |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
384 endif |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
385 endfor |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
386 endfunction |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
387 |
18531
2d0afa04d103
Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
388 function show_baseline (h, ~, hg = []) |
2d0afa04d103
Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
389 if (isempty (hg)) |
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", get (h, "showbaseline")); |
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 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
|
393 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
|
394 else |
2d0afa04d103
Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
395 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
|
396 endif |
2d0afa04d103
Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
397 endif |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
398 endfunction |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
399 |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
400 function move_baseline (h, ~) |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
401 b0 = get (h, "basevalue"); |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
402 bl = get (h, "baseline"); |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
403 |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
404 set (bl, "ydata", [b0, b0]); |
18531
2d0afa04d103
Make stemseries share the same baseline (bug #41593).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
405 set (bl, "basevalue", b0); |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
406 |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
407 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
|
408 yt = get (h, "ydata")(:)'; |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
409 ny = length (yt); |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
410 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
|
411 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
|
412 endfunction |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
413 |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
414 function update_props (h, ~) |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
415 kids = get (h, "children"); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
416 set (kids(2), "color", get (h, "color"), |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
417 "linestyle", get (h, "linestyle"), |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
418 "linewidth", get (h, "linewidth")); |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
419 set (kids(1), "color", get (h, "markeredgecolor"), |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
420 "marker", get (h, "marker"), |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
421 "markerfacecolor", get (h, "markerfacecolor"), |
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
422 "markersize", get (h, "markersize")); |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
423 endfunction |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
424 |
17432
77bec442a35a
Overhaul stem family of plot functions.
Rik <rik@octave.org>
parents:
17430
diff
changeset
|
425 function update_data (h, ~) |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
426 x = get (h, "xdata"); |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
427 y = get (h, "ydata"); |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
428 z = get (h, "zdata"); |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
429 |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19901
diff
changeset
|
430 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
|
431 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
|
432 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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 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
|
439 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
|
440 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
|
441 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
|
442 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
|
443 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
|
444 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
|
445 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
|
446 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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 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
|
453 endif |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
7218
diff
changeset
|
454 |
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
|
455 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
|
456 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
|
457 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
|
458 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
459 |