annotate scripts/plot/private/__line__.m @ 13929:9cae456085c2

Grammarcheck of documentation before 3.6.0 release. * accumarray.m, blkdiag.m, nargoutchk.m, nthargout.m, profexplore.m, profile.m, computer.m, orderfields.m, recycle.m, version.m, sqp.m, matlabroot.m, __plt_get_axis_arg__.m, isonormals.m, isosurface.m, __fltk_file_filter__.m, __is_function__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiobject_split_args__.m, __uiputfile_fltk__.m, uicontextmenu.m, uiresume.m, uiwait.m, mkpp.m, ppder.m, residue.m, addpref.m, getpref.m, ispref.m, loadprefs.m, prefsfile.m, saveprefs.m, rmpref.m, setpref.m, fftshift.m, bicg.m, bicgstab.m, cgs.m, gmres.m, __sprand_impl__.m, quantile.m, deblank.m, strsplit.m, addtodate.m, bsxfun.cc, kron.cc, regexp.cc, data.cc, file-io.cc, graphics.cc, load-save.cc, mappers.cc: Grammarcheck of documentation before 3.6.0 release.
author Rik <octave@nomad.inbox5.com>
date Wed, 23 Nov 2011 08:38:19 -0800
parents 571557ddabb9
children 72c96de7a403
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 9896
diff changeset
1 ## Copyright (C) 2005-2011 John W. Eaton
6405
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
2 ##
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
4 ##
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
8 ## your option) any later version.
6405
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
9 ##
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
14 ##
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6405
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
18
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8078
diff changeset
19 ## -*- texinfo -*-
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8078
diff changeset
20 ## @deftypefn {Function File} {@var{h} =} __line__ (@var{p}, @dots{})
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6405
diff changeset
21 ## Undocumented internal function.
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8078
diff changeset
22 ## @end deftypefn
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6405
diff changeset
23
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6405
diff changeset
24 ## __line__ (p, x, y, z)
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6405
diff changeset
25 ## Create line object from x, y, and z with parent p.
6405
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
26 ## Return handle to line object.
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
27
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
28 ## Author: jwe
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
29
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
30 function h = __line__ (p, varargin)
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
31
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
32 if (nargin < 1)
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
33 print_usage ();
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
34 endif
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
35
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
36 nvargs = numel (varargin);
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
37
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
38 if (nvargs > 1 && isnumeric (varargin{1}) && isnumeric (varargin{2}))
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
39 if (nvargs > 2 && isnumeric (varargin{3}))
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
40 num_data_args = 3;
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
41 else
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
42 num_data_args = 2;
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
43 endif
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
44 else
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
45 num_data_args = 0;
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
46 endif
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
47
13248
248d05c413dc Validate inputs to line() to prevent corrupting graphic toolkit (Bug #32345)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
48 if (num_data_args > 0 && ! size_equal (varargin{1:num_data_args}))
248d05c413dc Validate inputs to line() to prevent corrupting graphic toolkit (Bug #32345)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
49 error ("line: number of X, Y, and Z points must be equal");
248d05c413dc Validate inputs to line() to prevent corrupting graphic toolkit (Bug #32345)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
50 endif
248d05c413dc Validate inputs to line() to prevent corrupting graphic toolkit (Bug #32345)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
51
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 7277
diff changeset
52 if (rem (nvargs - num_data_args, 2) != 0)
13248
248d05c413dc Validate inputs to line() to prevent corrupting graphic toolkit (Bug #32345)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
53 error ("line: invalid number of PROPERTY / VALUE pairs");
6405
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
54 endif
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
55
7277
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7017
diff changeset
56 other_args = {};
6405
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
57 if (nvargs > num_data_args)
7277
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7017
diff changeset
58 other_args = varargin(num_data_args+1:end);
6405
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
59 endif
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
60
13235
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
61 nlines = 0;
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
62 nvecpts = 0;
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
63 ismat = false (1, 3);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
64 for i = 1:num_data_args
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
65 tmp = varargin{i}(:,:);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
66 if (isvector (tmp))
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
67 nlines = max (1, nlines);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
68 if (! isscalar (tmp))
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
69 if (nvecpts == 0)
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
70 nvecpts = numel (tmp);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
71 elseif (nvecpts != numel (tmp))
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
72 error ("line: data size mismatch");
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
73 endif
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
74 endif
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
75 else
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
76 ismat(i) = true;
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
77 nlines = max (columns (tmp), nlines);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
78 endif
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
79 varargin{i} = tmp;
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
80 endfor
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
81
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
82 if (num_data_args == 0)
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
83 varargin = {[0, 1], [0, 1]};
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
84 num_data_args = 2;
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
85 nlines = 1;
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
86 endif
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
87
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
88 handles = zeros (nlines, 1);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
89
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
90 data = cell (1, 3);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
91
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
92 if (num_data_args > 1)
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
93 data(1) = varargin{1};
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
94 data(2) = varargin{2};
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
95 if (num_data_args == 3)
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
96 data(3) = varargin{3};
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
97 endif
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
98 endif
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
99
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
100 data_args = reshape ({"xdata", "ydata", "zdata"; data{:}}, [1, 6]);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
101 mask = reshape ([false(1,3); ismat], [1, 6]);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
102
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
103 for i = 1:nlines
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
104 tmp = data(ismat);
13238
7467e90271f4 fix thinko in previous change to __line__.m
John W. Eaton <jwe@octave.org>
parents: 13235
diff changeset
105 if (! size_equal (tmp)
7467e90271f4 fix thinko in previous change to __line__.m
John W. Eaton <jwe@octave.org>
parents: 13235
diff changeset
106 || (nvecpts != 0 && any (nvecpts != cellfun ("size", tmp, 1))))
13235
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
107 error ("line: data size_mismatch");
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
108 endif
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
109
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
110 data_args(mask) = cellfun (@(x) x(:,i), data(ismat),
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
111 "uniformoutput", false);
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
112
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
113 handles(i) = __go_line__ (p, data_args{:}, other_args{:});
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
114
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
115 endfor
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
116
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
117 if (nargout > 0)
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
118 h = handles;
7b3afe09680b allow line function to accept matrix arguments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
119 endif
7277
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7017
diff changeset
120
6405
b298a4c12fc3 [project @ 2007-03-14 16:51:28 by jwe]
jwe
parents:
diff changeset
121 endfunction