annotate scripts/plot/draw/pareto.m @ 32074:03fe0b635d2e

quiver/quiver3: Overhaul input processing, validation, and add BISTs. * scripts/plot/draw/private/__quiver__.m: Overhaul numeric input validation. Simplify input classification using numeric input count switch statements and avoid quiver3 miscount due to scale factor. Add error messages for all valid numeric input combinations including vector x,y,z and scale factor. Move newplot command from quiver/quiver3 into __quiver__ after numeric input validation. Add hax as an output argument to return any changes back to calling function. * scripts/plot/draw/quiver.m: Remove newplot call. Update __quiver__ call to include hax as a return variable. Update docstring with note that line style and name-value pairs can both be provided but linstyle must appear first. Add BISTs to check standard inputs with single and multiple arrows, arrowhead shape, vector and array inputs, proper treatment of scaling factor "off", some simple input styles, and input validation BISTs to cover all numeric input errors. Added known failing BIST for linestyle+pair arrowhead showing when it should stay off (bug #64143). * scripts/plot/draw/quiver3.m: Remove newplot call. Update __quiver__ call to include hax as a return variable. Update docstring with note that line style and name-value pairs can both be provided but linstyle must appear first. Add BISTs to check standard inputs with single and multiple arrows, vector and array inputs, and input validation BISTs to cover all numeric input errors. * etc/NEWS.9.md: Update quiver/quiver3 improvement description under General Improvements.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Wed, 03 May 2023 22:52:33 -0400
parents 597f3ee61a48
children 2e484f9f1f18
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 ##
31706
597f3ee61a48 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
3 ## Copyright (C) 2003-2023 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
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/>.
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
7 ##
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
8 ## This file is part of Octave.
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
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
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
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.
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
14 ##
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
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.
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
19 ##
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
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 ########################################################################
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
25
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
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 {} {} pareto (@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 {} {} pareto (@var{y}, @var{x})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
29 ## @deftypefnx {} {} pareto (@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
30 ## @deftypefnx {} {@var{h} =} pareto (@dots{})
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
31 ## Draw a Pareto chart.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
32 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
33 ## A Pareto chart is a bar graph that arranges information in such a way
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17160
diff changeset
34 ## that priorities for process improvement can be established; It organizes
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
35 ## and displays information to show the relative importance of data. The chart
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
36 ## is similar to the histogram or bar chart, except that the bars are arranged
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
37 ## in decreasing magnitude from left to right along the x-axis.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
38 ##
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
39 ## The fundamental idea (Pareto principle) behind the use of Pareto
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
40 ## diagrams is that the majority of an effect is due to a small subset of the
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
41 ## causes. For quality improvement, the first few contributing causes
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
42 ## (leftmost bars as presented on the diagram) to a problem usually account for
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
43 ## the majority of the result. Thus, targeting these "major causes" for
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
44 ## elimination results in the most cost-effective improvement scheme.
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
45 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
46 ## Typically only the magnitude data @var{y} is present in which case
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
47 ## @var{x} is taken to be the range @code{1 : length (@var{y})}. If @var{x}
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
48 ## is given it may be a string array, a cell array of strings, or a numerical
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
49 ## vector.
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
50 ##
24431
0c6cedafc71e doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents: 23219
diff changeset
51 ## 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: 16814
diff changeset
52 ## rather than the current axes returned by @code{gca}.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
53 ##
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12931
diff changeset
54 ## The optional return value @var{h} is a 2-element vector with a graphics
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12931
diff changeset
55 ## handle for the created bar plot and a second handle for the created line
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12931
diff changeset
56 ## plot.
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12931
diff changeset
57 ##
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
58 ## An example of the use of @code{pareto} is
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
59 ##
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
60 ## @example
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
61 ## @group
9153
5247e89688e1 Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
62 ## Cheese = @{"Cheddar", "Swiss", "Camembert", ...
5247e89688e1 Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
63 ## "Munster", "Stilton", "Blue"@};
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
64 ## Sold = [105, 30, 70, 10, 15, 20];
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12931
diff changeset
65 ## pareto (Sold, Cheese);
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
66 ## @end group
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
67 ## @end example
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
68 ## @seealso{bar, barh, hist, pie, plot}
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
69 ## @end deftypefn
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
70
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
71 function h = pareto (varargin)
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
72
17160
6e8c621c3496 pareto.m: Accept an axis handle as first input.
Rik <rik@octave.org>
parents: 17122
diff changeset
73 [hax, varargin, nargin] = __plt_get_axis_arg__ ("pareto", varargin{:});
6e8c621c3496 pareto.m: Accept an axis handle as first input.
Rik <rik@octave.org>
parents: 17122
diff changeset
74
28891
de5f2f9a64ff maint: Use same coding style when checking for a minimum of 1 input.
Rik <rik@octave.org>
parents: 27923
diff changeset
75 if (nargin < 1 || nargin > 2)
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
76 print_usage ();
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
77 endif
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
78
17523
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
79 y = varargin{1}(:).';
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
80 if (nargin == 2)
17523
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
81 x = varargin{2}(:).';
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
82 if (! iscell (x))
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
83 if (ischar (x))
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
84 x = cellstr (x);
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
85 else
17523
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
86 x = cellstr (num2str (x(:)));
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
87 endif
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
88 endif
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
89 else
17523
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
90 x = cellstr (int2str ([1:numel(y)]'));
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
91 endif
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
92
17523
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
93 [y, idx] = sort (y, "descend");
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
94 x = x(idx);
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
95 cdf = cumsum (y);
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
96 maxcdf = cdf(end);
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
97 cdf ./= maxcdf;
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
98 idx95 = find (cdf < 0.95, 1, "last") + 1;
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
99
17160
6e8c621c3496 pareto.m: Accept an axis handle as first input.
Rik <rik@octave.org>
parents: 17122
diff changeset
100 if (isempty (hax))
17523
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
101 [ax, hbar, hline] = plotyy (1 : idx95, y(1:idx95),
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
102 1 : length (cdf), 100 * cdf,
17160
6e8c621c3496 pareto.m: Accept an axis handle as first input.
Rik <rik@octave.org>
parents: 17122
diff changeset
103 @bar, @plot);
6e8c621c3496 pareto.m: Accept an axis handle as first input.
Rik <rik@octave.org>
parents: 17122
diff changeset
104 else
17523
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
105 [ax, hbar, hline] = plotyy (hax, 1 : idx95, y(1:idx95),
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
106 1 : length (cdf), 100 * cdf,
17160
6e8c621c3496 pareto.m: Accept an axis handle as first input.
Rik <rik@octave.org>
parents: 17122
diff changeset
107 @bar, @plot);
6e8c621c3496 pareto.m: Accept an axis handle as first input.
Rik <rik@octave.org>
parents: 17122
diff changeset
108 endif
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
109
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
110 axis (ax(1), [1 - 0.6, idx95 + 0.6, 0, maxcdf]);
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
111 axis (ax(2), [1 - 0.6, idx95 + 0.6, 0, 100]);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
112 set (ax(2), "ytick", [0, 20, 40, 60, 80, 100],
18890
f1e21a495e20 pareto.m: Use same color for left/right axes and for bar/line.
Rik <rik@octave.org>
parents: 17744
diff changeset
113 "yticklabel", {"0%", "20%", "40%", "60%", "80%", "100%"},
f1e21a495e20 pareto.m: Use same color for left/right axes and for bar/line.
Rik <rik@octave.org>
parents: 17744
diff changeset
114 "ycolor", get (ax(1), "ycolor"));
f1e21a495e20 pareto.m: Use same color for left/right axes and for bar/line.
Rik <rik@octave.org>
parents: 17744
diff changeset
115 set (hline, "color", get (ax(1), "colororder")(1,:));
17523
968c99137122 pareto.m: Include 95% of CDF for Matlab compatibility.
Rik <rik@octave.org>
parents: 17386
diff changeset
116 set (ax(1:2), "xtick", 1:idx95, "xticklabel", x(1:idx95));
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
117
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
118 if (nargout > 0)
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
119 h = [hbar; hline];
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
120 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
121
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
122 endfunction
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
123
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12931
diff changeset
124
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
125 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
126 %! clf;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12931
diff changeset
127 %! colormap (jet (64));
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 20852
diff changeset
128 %! Cheese = {"Cheddar", "Swiss", "Camembert", "Munster", "Stilton", "Blue"};
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
129 %! Sold = [105, 30, 70, 10, 15, 20];
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12931
diff changeset
130 %! pareto (Sold, Cheese);
24388
206ef5cb8b16 Add titles to most plot demos.
Rik <rik@octave.org>
parents: 23220
diff changeset
131 %! title ("pareto() demo #1");
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
132
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
133 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
134 %! clf;
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 20852
diff changeset
135 %! ## Suppose that we want establish which products makes 80% of turnover.
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 20852
diff changeset
136 %! Codes = {"AB4","BD7","CF8","CC5","AD11","BB5","BB3","AD8","DF3","DE7"};
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 20852
diff changeset
137 %! Value = [2.35 7.9 2.45 1.1 0.15 13.45 5.4 2.05 0.85 1.65]';
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
138 %! SoldUnits = [54723 41114 16939 1576091 168000 687197 120222 168195, ...
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
139 %! 1084118 55576]';
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents:
diff changeset
140 %! pareto (Value.*SoldUnits, Codes);
24388
206ef5cb8b16 Add titles to most plot demos.
Rik <rik@octave.org>
parents: 23220
diff changeset
141 %! title ("pareto() demo #2");