Mercurial > hg > octave-lyh
annotate scripts/plot/line.m @ 17101:e7a059a9a644
doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Correctly use @xref, @pxref, @ref macros in documentation.
* doc/interpreter/arith.txi, doc/interpreter/basics.txi,
doc/interpreter/container.txi, doc/interpreter/debug.txi,
doc/interpreter/diagperm.txi, doc/interpreter/eval.txi,
doc/interpreter/external.txi, doc/interpreter/func.txi,
doc/interpreter/install.txi, doc/interpreter/interp.txi,
doc/interpreter/intro.txi, doc/interpreter/java.txi,
doc/interpreter/matrix.txi, doc/interpreter/munge-texi.pl,
doc/interpreter/numbers.txi, doc/interpreter/package.txi,
doc/interpreter/plot.txi, doc/interpreter/sparse.txi,
doc/interpreter/stats.txi, doc/interpreter/strings.txi,
doc/interpreter/system.txi, doc/interpreter/var.txi,
doc/interpreter/vectorize.txi, libinterp/corefcn/error.cc,
libinterp/corefcn/qz.cc, libinterp/corefcn/regexp.cc,
scripts/general/accumarray.m, scripts/general/structfun.m,
scripts/miscellaneous/edit.m, scripts/miscellaneous/setfield.m,
scripts/miscellaneous/warning_ids.m, scripts/optimization/fminbnd.m,
scripts/optimization/fzero.m, scripts/optimization/lsqnonneg.m:
Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Correctly use @xref, @pxref, @ref macros in documentation.
* scripts/plot/line.m: Remove extra ')' in @deftypefn.
* libgui/src/qtinfo/parser.cc(find_ref): Change doc anchor search pattern to
XREF.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 27 Jul 2013 10:49:21 -0700 |
parents | 08dd9458684a |
children | eaab03308c0b |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13141
diff
changeset
|
1 ## Copyright (C) 2005-2012 John W. Eaton |
6257 | 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 | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6257 | 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 | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6257 | 18 |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
20 ## @deftypefn {Function File} {} line () |
6405 | 21 ## @deftypefnx {Function File} {} line (@var{x}, @var{y}) |
17101
e7a059a9a644
doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents:
17036
diff
changeset
|
22 ## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{property}, @var{value}, @dots{}) |
6257 | 23 ## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}) |
6895 | 24 ## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}, @var{property}, @var{value}, @dots{}) |
17015
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
25 ## @deftypefnx {Function File} {} line (@var{property}, @var{value}, @dots{}) |
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
26 ## @deftypefnx {Function File} {@var{h} =} line (@dots{}) |
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
27 ## Create line object from @var{x} and @var{y} (and possibly @var{z}) and |
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
28 ## insert in the current axes. |
6895 | 29 ## |
17015
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
30 ## Multiple property-value pairs may be specified for the line object, but they |
6895 | 31 ## must appear in pairs. |
17015
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
32 ## |
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
33 ## The optional return value @var{h} is a graphics handle (or vector of handles) |
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
34 ## to the line objects created. |
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
35 ## |
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
36 ## @seealso{image, patch, rectangle, surface, text} |
6257 | 37 ## @end deftypefn |
38 | |
39 ## Author: jwe | |
40 | |
41 function h = line (varargin) | |
42 | |
17036
08dd9458684a
Overhaul __plt_get_axis_arg__ and newplot functions to avoid creating unnecessary axes.
Rik <rik@octave.org>
parents:
17015
diff
changeset
|
43 ## Get axis argument which may be in a 'parent' PROP/VAL pair |
17015
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
44 [hax, varargin] = __plt_get_axis_arg__ ("line", varargin{:}); |
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
45 |
17036
08dd9458684a
Overhaul __plt_get_axis_arg__ and newplot functions to avoid creating unnecessary axes.
Rik <rik@octave.org>
parents:
17015
diff
changeset
|
46 if (isempty (hax)) |
08dd9458684a
Overhaul __plt_get_axis_arg__ and newplot functions to avoid creating unnecessary axes.
Rik <rik@octave.org>
parents:
17015
diff
changeset
|
47 hax = gca (); |
08dd9458684a
Overhaul __plt_get_axis_arg__ and newplot functions to avoid creating unnecessary axes.
Rik <rik@octave.org>
parents:
17015
diff
changeset
|
48 endif |
08dd9458684a
Overhaul __plt_get_axis_arg__ and newplot functions to avoid creating unnecessary axes.
Rik <rik@octave.org>
parents:
17015
diff
changeset
|
49 |
17015
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
50 htmp = __line__ (hax, varargin{:}); |
6257 | 51 |
6405 | 52 if (nargout > 0) |
17015
761d2be77e78
__plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents:
17014
diff
changeset
|
53 h = htmp; |
6257 | 54 endif |
55 | |
56 endfunction | |
13096 | 57 |
16828
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
14849
diff
changeset
|
58 |
14535
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
59 %!demo |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
60 %! clf |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
61 %! x = 0:0.3:10; |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
62 %! y1 = cos (x); |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
63 %! y2 = sin (x); |
14849
f6d3d5b0bd42
test: Use Octave coding conventions for tests for line() and toc().
Rik <octave@nomad.inbox5.com>
parents:
14535
diff
changeset
|
64 %! subplot (3,1,1); |
16828
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
14849
diff
changeset
|
65 %! args = {'color', 'b', 'marker', 's'}; |
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
14849
diff
changeset
|
66 %! line ([x(:), x(:)], [y1(:), y2(:)], args{:}); |
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
14849
diff
changeset
|
67 %! title ('Test broadcasting for line()'); |
14849
f6d3d5b0bd42
test: Use Octave coding conventions for tests for line() and toc().
Rik <octave@nomad.inbox5.com>
parents:
14535
diff
changeset
|
68 %! subplot (3,1,2); |
16828
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
14849
diff
changeset
|
69 %! line (x(:), [y1(:), y2(:)], args{:}); |
14849
f6d3d5b0bd42
test: Use Octave coding conventions for tests for line() and toc().
Rik <octave@nomad.inbox5.com>
parents:
14535
diff
changeset
|
70 %! subplot (3,1,3); |
16828
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
14849
diff
changeset
|
71 %! line ([x(:), x(:)+pi/2], y1(:), args{:}); |
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
14849
diff
changeset
|
72 %! xlim ([0 10]); |
14535
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
73 |
13096 | 74 %!test |
13124
2ea1658ad049
Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents:
13115
diff
changeset
|
75 %! hf = figure ("visible", "off"); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
13124
diff
changeset
|
76 %! unwind_protect |
13096 | 77 %! h = line; |
13115
cd808de114c1
Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents:
13111
diff
changeset
|
78 %! assert (findobj (hf, "type", "line"), h); |
13096 | 79 %! assert (get (h, "xdata"), [0 1], eps); |
80 %! assert (get (h, "ydata"), [0 1], eps); | |
81 %! assert (get (h, "type"), "line"); | |
13115
cd808de114c1
Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents:
13111
diff
changeset
|
82 %! assert (get (h, "color"), get (0, "defaultlinecolor")); |
cd808de114c1
Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents:
13111
diff
changeset
|
83 %! assert (get (h, "linestyle"), get (0, "defaultlinelinestyle")); |
cd808de114c1
Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents:
13111
diff
changeset
|
84 %! assert (get (h, "linewidth"), get (0, "defaultlinelinewidth"), eps); |
13096 | 85 %! unwind_protect_cleanup |
86 %! close (hf); | |
87 %! end_unwind_protect | |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
88 |