Mercurial > octave
annotate scripts/plot/appearance/gtext.m @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
1 ## Copyright (C) 2008-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27794
diff
changeset
|
2 ## |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27794
diff
changeset
|
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27794
diff
changeset
|
4 ## or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27794
diff
changeset
|
5 ## |
7674
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
6 ## |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
7 ## This file is part of Octave. |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
8 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
9 ## Octave is free software: you can redistribute it and/or modify it |
7674
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
10 ## 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:
23220
diff
changeset
|
11 ## 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
|
12 ## (at your option) any later version. |
7674
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
13 ## |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
14 ## Octave is distributed in the hope that it will be useful, but |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## GNU General Public License for more details. |
7674
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
18 ## |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
19 ## You should have received a copy of the GNU General Public License |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
20 ## 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:
23220
diff
changeset
|
21 ## <https://www.gnu.org/licenses/>. |
7674
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
22 |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
23 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
24 ## @deftypefn {} {} gtext (@var{s}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
25 ## @deftypefnx {} {} gtext (@{@var{s1}, @var{s2}, @dots{}@}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
26 ## @deftypefnx {} {} gtext (@{@var{s1}; @var{s2}; @dots{}@}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
27 ## @deftypefnx {} {} gtext (@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
|
28 ## @deftypefnx {} {@var{h} =} gtext (@dots{}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
15072
diff
changeset
|
29 ## Place text on the current figure using the mouse. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
15072
diff
changeset
|
30 ## |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
31 ## The string argument @var{s} may be a character array or a cell array |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
32 ## of strings. If @var{s} has more than one row, each row is used |
27794
45ad2127582b
doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents:
27113
diff
changeset
|
33 ## to create a separate text object after a mouse click. For example: |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
34 ## |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
35 ## Place a single string after one mouse click |
27794
45ad2127582b
doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents:
27113
diff
changeset
|
36 ## |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
37 ## @example |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
38 ## gtext ("I clicked here") |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
39 ## @end example |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
15072
diff
changeset
|
40 ## |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
41 ## Place two strings after two mouse clicks |
27794
45ad2127582b
doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents:
27113
diff
changeset
|
42 ## |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
43 ## @example |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
44 ## gtext (@{"I clicked here"; "and there"@}) |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
45 ## @end example |
15070
1feefc5e5630
gtext.m: Allow multiple text placements--one per mouse click.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
46 ## |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
47 ## Place two strings, each with two lines, after two mouse clicks |
27794
45ad2127582b
doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents:
27113
diff
changeset
|
48 ## |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
49 ## @example |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
50 ## gtext (@{"I clicked", "here"; "and", "there"@}) |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
51 ## @end example |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
52 ## |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
53 ## Optional @var{property}/@var{value} pairs are passed directly to the |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
54 ## underlying text objects. |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
55 ## |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
56 ## The optional return value @var{h} holds the graphics handle(s) to the |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
57 ## created text object(s). |
9307
c2923c27c877
Various documentation improvements
Rik <rdrider0-list@yahoo.com>
parents:
9245
diff
changeset
|
58 ## @seealso{ginput, text} |
7674
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
59 ## @end deftypefn |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
60 |
15070
1feefc5e5630
gtext.m: Allow multiple text placements--one per mouse click.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
61 function h = gtext (s, varargin) |
7674
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
62 |
13259
b6efe55f97c7
Allow gtext() to have multi-line text strings (Bug #33232)
Rik <octave@nomad.inbox5.com>
parents:
13123
diff
changeset
|
63 if (nargin < 1) |
7674
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
64 print_usage (); |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
65 endif |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
66 |
13259
b6efe55f97c7
Allow gtext() to have multi-line text strings (Bug #33232)
Rik <octave@nomad.inbox5.com>
parents:
13123
diff
changeset
|
67 if (! (ischar (s) || iscellstr (s))) |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
68 error ("gtext: S must a character array or cell array of strings"); |
13259
b6efe55f97c7
Allow gtext() to have multi-line text strings (Bug #33232)
Rik <octave@nomad.inbox5.com>
parents:
13123
diff
changeset
|
69 endif |
b6efe55f97c7
Allow gtext() to have multi-line text strings (Bug #33232)
Rik <octave@nomad.inbox5.com>
parents:
13123
diff
changeset
|
70 |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
71 htmp = []; |
13259
b6efe55f97c7
Allow gtext() to have multi-line text strings (Bug #33232)
Rik <octave@nomad.inbox5.com>
parents:
13123
diff
changeset
|
72 if (! isempty (s)) |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
73 for i = 1:rows (s) |
15070
1feefc5e5630
gtext.m: Allow multiple text placements--one per mouse click.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
74 [x, y] = ginput (1); |
27113
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
75 htmp = [htmp, text(x, y, s(i,:), varargin{:})]; |
d6372c07bac2
Overhaul gtext for compatibility (bug #56386)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
76 endfor |
15070
1feefc5e5630
gtext.m: Allow multiple text placements--one per mouse click.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
77 endif |
1feefc5e5630
gtext.m: Allow multiple text placements--one per mouse click.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
78 |
1feefc5e5630
gtext.m: Allow multiple text placements--one per mouse click.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
79 if (nargout > 0) |
1feefc5e5630
gtext.m: Allow multiple text placements--one per mouse click.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
80 h = htmp; |
13259
b6efe55f97c7
Allow gtext() to have multi-line text strings (Bug #33232)
Rik <octave@nomad.inbox5.com>
parents:
13123
diff
changeset
|
81 endif |
b6efe55f97c7
Allow gtext() to have multi-line text strings (Bug #33232)
Rik <octave@nomad.inbox5.com>
parents:
13123
diff
changeset
|
82 |
7674
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
83 endfunction |
52d8d50e74c1
Add gtext, waitforbuttonpress. Attempt to get ginput working under windows
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
84 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
85 |
13123
6efa1a691713
Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents:
11587
diff
changeset
|
86 ## Remove from test statistics. No real tests possible. |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
87 %!assert (1) |