Mercurial > octave
annotate scripts/plot/draw/bar.m @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | 363fb10055df |
children | 597f3ee61a48 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30379
diff
changeset
|
3 ## Copyright (C) 1993-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27898
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
2313 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
2313 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
2313 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
2313 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
245 | 25 |
3368 | 26 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
27 ## @deftypefn {} {} bar (@var{y}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
28 ## @deftypefnx {} {} bar (@var{x}, @var{y}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
29 ## @deftypefnx {} {} bar (@dots{}, @var{w}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
30 ## @deftypefnx {} {} bar (@dots{}, @var{style}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
31 ## @deftypefnx {} {} bar (@dots{}, @var{prop}, @var{val}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
32 ## @deftypefnx {} {} bar (@var{hax}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
33 ## @deftypefnx {} {@var{h} =} bar (@dots{}, @var{prop}, @var{val}, @dots{}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
34 ## Produce a bar graph from two vectors of X-Y data. |
3426 | 35 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
36 ## If only one argument is given, @var{y}, it is taken as a vector of Y values |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
37 ## and the X coordinates are the range @code{1:numel (@var{y})}. |
3426 | 38 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
39 ## The optional input @var{w} controls the width of the bars. A value of |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
40 ## 1.0 will cause each bar to exactly touch any adjacent bars. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
41 ## The default width is 0.8. |
7096 | 42 ## |
6540 | 43 ## If @var{y} is a matrix, then each column of @var{y} is taken to be a |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
44 ## separate bar graph plotted on the same graph. By default the columns |
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
45 ## are plotted side-by-side. This behavior can be changed by the @var{style} |
17519
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
46 ## argument which can take the following values: |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
47 ## |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
48 ## @table @asis |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
49 ## @item @qcode{"grouped"} (default) |
21546
f7f97d7e9294
doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
50 ## Side-by-side bars with a gap between bars and centered over the |
f7f97d7e9294
doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
51 ## X-coordinate. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
52 ## |
17519
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
53 ## @item @qcode{"stacked"} |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
54 ## Bars are stacked so that each X value has a single bar composed of |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
55 ## multiple segments. |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
56 ## |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
57 ## @item @qcode{"hist"} |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
58 ## Side-by-side bars with no gap between bars and centered over the |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
59 ## X-coordinate. |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
60 ## |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
61 ## @item @qcode{"histc"} |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
62 ## Side-by-side bars with no gap between bars and left-aligned to the |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
63 ## X-coordinate. |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
64 ## @end table |
6540 | 65 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
66 ## Optional property/value pairs are passed directly to the underlying patch |
28733
9342688e86b4
Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27923
diff
changeset
|
67 ## objects. The full list of properties is documented at |
9342688e86b4
Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27923
diff
changeset
|
68 ## @ref{Patch Properties}. |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
69 ## |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
70 ## If the first argument @var{hax} is an axes handle, then plot into this axes, |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
71 ## rather than the current axes returned by @code{gca}. |
16814
64e7bb01fce2
doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents:
15565
diff
changeset
|
72 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
73 ## The optional return value @var{h} is a vector of handles to the created |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
74 ## "bar series" hggroups with one handle per column of the variable @var{y}. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
75 ## This series makes it possible to change a common element in one bar series |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
76 ## object and have the change reflected in the other "bar series". |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
77 ## For example, |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
78 ## |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
79 ## @example |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
80 ## @group |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
81 ## h = bar (rand (5, 10)); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
82 ## set (h(1), "basevalue", 0.5); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
83 ## @end group |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
84 ## @end example |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
85 ## |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
86 ## @noindent |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
87 ## changes the position on the base of all of the bar series. |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7189
diff
changeset
|
88 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
89 ## The following example modifies the face and edge colors using |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
90 ## property/value pairs. |
3426 | 91 ## |
11366
ad8966096e27
bar.m: Improve the docstring.
Rik <octave@nomad.inbox5.com>
parents:
10846
diff
changeset
|
92 ## @example |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
93 ## bar (randn (1, 100), "facecolor", "r", "edgecolor", "b"); |
11366
ad8966096e27
bar.m: Improve the docstring.
Rik <octave@nomad.inbox5.com>
parents:
10846
diff
changeset
|
94 ## @end example |
ad8966096e27
bar.m: Improve the docstring.
Rik <octave@nomad.inbox5.com>
parents:
10846
diff
changeset
|
95 ## |
ad8966096e27
bar.m: Improve the docstring.
Rik <octave@nomad.inbox5.com>
parents:
10846
diff
changeset
|
96 ## @noindent |
29130
8bb14f4979ca
Use colors from axes' "ColorOrder" property for bar charts for Matlab compatibility (bug #59589).
Rik <rik@octave.org>
parents:
29071
diff
changeset
|
97 ## The default color for bars is taken from the axes' @qcode{"ColorOrder"} |
29139
f5e89a80ba8c
Use colors from "colormap" property for bar, barh if a "hist" option was given (bug #59589).
Rik <rik@octave.org>
parents:
29130
diff
changeset
|
98 ## property. The default color for bars when a histogram option |
f5e89a80ba8c
Use colors from "colormap" property for bar, barh if a "hist" option was given (bug #59589).
Rik <rik@octave.org>
parents:
29130
diff
changeset
|
99 ## (@qcode{"hist"}, @qcode{"histc"} is used is the @qcode{"Colormap"} property |
f5e89a80ba8c
Use colors from "colormap" property for bar, barh if a "hist" option was given (bug #59589).
Rik <rik@octave.org>
parents:
29130
diff
changeset
|
100 ## of either the axes or figure. The color of bars can also be set manually |
f5e89a80ba8c
Use colors from "colormap" property for bar, barh if a "hist" option was given (bug #59589).
Rik <rik@octave.org>
parents:
29130
diff
changeset
|
101 ## using the @qcode{"facecolor"} property as shown below. |
10572
148559d9d4ac
Document the use of the colormap for bar plots
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
102 ## |
148559d9d4ac
Document the use of the colormap for bar plots
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
103 ## @example |
148559d9d4ac
Document the use of the colormap for bar plots
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
104 ## @group |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
105 ## h = bar (rand (10, 3)); |
10572
148559d9d4ac
Document the use of the colormap for bar plots
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
106 ## set (h(1), "facecolor", "r") |
148559d9d4ac
Document the use of the colormap for bar plots
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
107 ## set (h(2), "facecolor", "g") |
148559d9d4ac
Document the use of the colormap for bar plots
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
108 ## set (h(3), "facecolor", "b") |
148559d9d4ac
Document the use of the colormap for bar plots
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
109 ## @end group |
148559d9d4ac
Document the use of the colormap for bar plots
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
110 ## @end example |
148559d9d4ac
Document the use of the colormap for bar plots
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
111 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17032
diff
changeset
|
112 ## @seealso{barh, hist, pie, plot, patch} |
3368 | 113 ## @end deftypefn |
4 | 114 |
6540 | 115 function varargout = bar (varargin) |
116 varargout = cell (nargout, 1); | |
29146
3000414c60eb
Return patch objects for bar,barh rather than hggroups when 'hist' is given (bug #59589).
Rik <rik@octave.org>
parents:
29139
diff
changeset
|
117 [varargout{:}] = __bar__ ("bar", true, varargin{:}); |
4 | 118 endfunction |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
119 |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
120 |
15565
de751531e548
test: Add demos for bar.m and barh.m
Rik <rik@octave.org>
parents:
14327
diff
changeset
|
121 %!demo |
de751531e548
test: Add demos for bar.m and barh.m
Rik <rik@octave.org>
parents:
14327
diff
changeset
|
122 %! clf; |
17032
53d6166f7867
Fix bar() update for ydata listener.
Ben Abbott <bpabbott@mac.com>
parents:
16814
diff
changeset
|
123 %! y = rand (11, 1); |
53d6166f7867
Fix bar() update for ydata listener.
Ben Abbott <bpabbott@mac.com>
parents:
16814
diff
changeset
|
124 %! h = bar (y); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
125 %! set (h, "ydata", sort (rand (11, 1))); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
126 %! title ("bar() graph"); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
127 |
15565
de751531e548
test: Add demos for bar.m and barh.m
Rik <rik@octave.org>
parents:
14327
diff
changeset
|
128 %!demo |
de751531e548
test: Add demos for bar.m and barh.m
Rik <rik@octave.org>
parents:
14327
diff
changeset
|
129 %! clf; |
de751531e548
test: Add demos for bar.m and barh.m
Rik <rik@octave.org>
parents:
14327
diff
changeset
|
130 %! h = bar (rand (5, 3)); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
131 %! set (h(1), "facecolor", "r"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
132 %! set (h(2), "facecolor", "g"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
133 %! set (h(3), "facecolor", "b"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
134 %! title ("bar() graph w/multiple bars"); |
15565
de751531e548
test: Add demos for bar.m and barh.m
Rik <rik@octave.org>
parents:
14327
diff
changeset
|
135 |
17519
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
136 %!demo |
cc9befe5d271
Overhaul bar family of plot functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
137 %! clf; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
138 %! h = bar (rand (5, 3), "stacked"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
139 %! title ("bar() graph with stacked style"); |
29071
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
140 |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
141 %!demo |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
142 %! clf; |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
143 %! y = -rand (3) .* eye (3) + rand (3) .* (! eye (3)); |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
144 %! h = bar (y, "stacked"); |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
145 %! title ("stacked bar() graph including intermingled negative values"); |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
146 |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
147 %% Test input validation |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
148 %!error bar () |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
149 %!error <Y must be numeric> bar ("foo") |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
150 %!error <X must be a vector> bar ([1 2; 3 4], [1 2 3 4]) |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
151 %!error <X vector values must be unique> bar ([1 2 3 3], [1 2 3 4]) |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
152 %!error <length of X and Y must be equal> bar ([1 2 3], [1 2 3 4]) |
d2f7fb06bce3
Fixed stacked bar chart handling of negative values (bug #58216)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
28733
diff
changeset
|
153 %!error <length of X and Y must be equal> bar ([1 2 3 4], [1 2 3]) |