annotate scripts/plot/appearance/xlabel.m @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 0a5b15007766
children 597f3ee61a48
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 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
3 ## Copyright (C) 1993-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27898
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/>.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
7 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
8 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
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
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
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.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
14 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
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.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
19 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
20 ## 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
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 ########################################################################
245
16a24e76d6e0 [project @ 1993-12-03 02:00:15 by jwe]
jwe
parents: 4
diff changeset
25
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 2847
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 {} {} xlabel (@var{string})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
28 ## @deftypefnx {} {} xlabel (@var{string}, @var{property}, @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
29 ## @deftypefnx {} {} xlabel (@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} =} xlabel (@dots{})
17048
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
31 ## Specify the string used to label the x-axis of the current axis.
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
32 ##
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
33 ## An optional list of @var{property}/@var{value} pairs can be used to change
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
34 ## the properties of the created text label.
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
35 ##
28733
9342688e86b4 Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents: 27923
diff changeset
36 ## The full list of text object properties is documented at
9342688e86b4 Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents: 27923
diff changeset
37 ## @ref{Text Properties}.
9342688e86b4 Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents: 27923
diff changeset
38 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17048
diff changeset
39 ## If the first argument @var{hax} is an axes handle, then operate on
24431
0c6cedafc71e doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents: 23219
diff changeset
40 ## this axes rather than the current axes returned by @code{gca}.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17048
diff changeset
41 ##
17048
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
42 ## The optional return value @var{h} is a graphics handle to the created text
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
43 ## object.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17048
diff changeset
44 ## @seealso{ylabel, zlabel, datetick, title, text}
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 2847
diff changeset
45 ## @end deftypefn
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
46
17048
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
47 function h = xlabel (varargin)
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
48
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
49 [hax, varargin, nargin] = __plt_get_axis_arg__ ("xlabel", varargin{:});
4529
78954aeaf321 [project @ 2003-10-04 19:35:36 by jwe]
jwe
parents: 3979
diff changeset
50
17048
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
51 if (isempty (hax))
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
52 hax = gca ();
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
53 endif
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
54
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
55 if (rem (nargin, 2) != 1)
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
56 print_usage ();
7194
a927a2871a93 [project @ 2007-11-26 23:06:12 by jwe]
jwe
parents: 7017
diff changeset
57 endif
a927a2871a93 [project @ 2007-11-26 23:06:12 by jwe]
jwe
parents: 7017
diff changeset
58
17048
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
59 htmp = __axis_label__ (hax, "xlabel", varargin{1},
22292
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
60 "color", get (hax, "xcolor"),
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
61 varargin{2:end});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
62
7194
a927a2871a93 [project @ 2007-11-26 23:06:12 by jwe]
jwe
parents: 7017
diff changeset
63 if (nargout > 0)
17048
3f99d7d22bd0 x(yz)label.m, title.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14138
diff changeset
64 h = htmp;
4529
78954aeaf321 [project @ 2003-10-04 19:35:36 by jwe]
jwe
parents: 3979
diff changeset
65 endif
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
66
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
67 endfunction
13136
79b9a7669bb8 Tests added for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11598
diff changeset
68
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13800
diff changeset
69
13136
79b9a7669bb8 Tests added for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11598
diff changeset
70 %!test
79b9a7669bb8 Tests added for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11598
diff changeset
71 %! hf = figure ("visible", "off");
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 13136
diff changeset
72 %! unwind_protect
22292
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
73 %! hx = xlabel ("xlabel_string");
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
74 %! assert (get (gca, "xlabel"), hx);
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
75 %! assert (get (hx, "type"), "text");
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
76 %! assert (get (hx, "visible"), "on");
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
77 %! assert (get (hx, "string"), "xlabel_string");
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
78 %! assert (get (hx, "color"), get (0, "defaultaxesxcolor"));
13136
79b9a7669bb8 Tests added for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11598
diff changeset
79 %! unwind_protect_cleanup
79b9a7669bb8 Tests added for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11598
diff changeset
80 %! close (hf);
79b9a7669bb8 Tests added for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11598
diff changeset
81 %! end_unwind_protect
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13800
diff changeset
82
22292
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
83 %!test
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
84 %! hf = figure ("visible", "off");
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
85 %! unwind_protect
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
86 %! set (gca, "fontsize", 5, "labelfontsizemultiplier", 3);
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
87 %! hx = xlabel ("xlabel_string", "color", "r");
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
88 %! assert (get (hx, "fontsize"), 15);
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
89 %! assert (get (hx, "color"), [1 0 0]);
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
90 %! unwind_protect_cleanup
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
91 %! close (hf);
378f8c0de848 Implement TitleFontSizeMultiplier, LabelFontSizeMultiplier, TitleFontWeight props.
Rik <rik@octave.org>
parents: 20852
diff changeset
92 %! end_unwind_protect