Mercurial > hg > octave-lyh
annotate scripts/plot/line.m @ 16505:ff061068a66c
move dialog files to separate directory
* scripts/ui/errordlg.m, scripts/ui/helpdlg.m, scripts/ui/inputdlg.m,
scripts/ui/listdlg.m, scripts/ui/msgbox.m, scripts/ui/questdlg.m,
scripts/ui/warndlg.m: Move here from scripts/java.
* scripts/java/module.mk (java_FCN_FILES): Update list.
* scripts/ui/module.mk: New file.
* scripts/Makefile.am: Include it.
(ui/PKG_ADD, $(ui_GEN_FCN_FILES), ui/$(octave_dirstamp)): New targets.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 12 Apr 2013 14:51:51 -0400 |
parents | f6d3d5b0bd42 |
children | ddac88d32d6a |
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}) |
6257 | 22 ## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}) |
6895 | 23 ## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}, @var{property}, @var{value}, @dots{}) |
6257 | 24 ## Create line object from @var{x} and @var{y} and insert in current |
6895 | 25 ## axes object. Return a handle (or vector of handles) to the line |
26 ## objects created. | |
27 ## | |
28 ## Multiple property-value pairs may be specified for the line, but they | |
29 ## must appear in pairs. | |
6257 | 30 ## @end deftypefn |
31 | |
32 ## Author: jwe | |
33 | |
34 function h = line (varargin) | |
35 | |
6405 | 36 ## make a default line object, and make it the current axes for |
37 ## the current figure. | |
38 tmp = __line__ (gca (), varargin{:}); | |
6257 | 39 |
6405 | 40 if (nargout > 0) |
41 h = tmp; | |
6257 | 42 endif |
43 | |
44 endfunction | |
13096 | 45 |
14535
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
46 %!demo |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
47 %! clf |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
48 %! x = 0:0.3:10; |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
49 %! y1 = cos (x); |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
50 %! 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
|
51 %! subplot (3,1,1); |
14535
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
52 %! args = {"color", "b", "marker", "s"}; |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
53 %! line ([x(:), x(:)], [y1(:), y2(:)], args{:}) |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
54 %! 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
|
55 %! subplot (3,1,2); |
14535
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
56 %! 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
|
57 %! subplot (3,1,3); |
14535
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
58 %! line ([x(:), x(:)+pi/2], y1(:), args{:}) |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
59 %! xlim ([0 10]) |
8150ccfffa22
Apply broadcasting to inputs of line().
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
60 |
13096 | 61 %!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
|
62 %! 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
|
63 %! unwind_protect |
13096 | 64 %! 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
|
65 %! assert (findobj (hf, "type", "line"), h); |
13096 | 66 %! assert (get (h, "xdata"), [0 1], eps); |
67 %! assert (get (h, "ydata"), [0 1], eps); | |
68 %! 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
|
69 %! 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
|
70 %! 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
|
71 %! assert (get (h, "linewidth"), get (0, "defaultlinelinewidth"), eps); |
13096 | 72 %! unwind_protect_cleanup |
73 %! close (hf); | |
74 %! end_unwind_protect | |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
75 |