Mercurial > octave
annotate scripts/plot/appearance/ztickangle.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 | 7854d5752dd2 |
children | 5d3faba0342e |
rev | line source |
---|---|
29024
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
1 ######################################################################## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3 ## Copyright (C) 2020-2022 The Octave Project Developers |
29024
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
4 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
7 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
9 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
13 ## (at your option) any later version. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
14 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
18 ## GNU General Public License for more details. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
19 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
23 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
24 ######################################################################## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
25 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
27 ## @deftypefn {} {@var{angle} =} ztickangle () |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
28 ## @deftypefnx {} {@var{angle} =} ztickangle (@var{hax}) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
29 ## @deftypefnx {} {} ztickangle (@var{angle}) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
30 ## @deftypefnx {} {} ztickangle (@var{hax}, @var{angle}) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
31 ## Query or set the rotation angle of the tick labels on the z-axis of the |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
32 ## current axes. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
33 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
34 ## When called without an argument, return the rotation angle in degrees of the |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
35 ## tick labels as specified in the axes property @qcode{"ZTickLabelRotation"}. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
36 ## When called with a numeric scalar @var{angle}, rotate the tick labels |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
37 ## counterclockwise to @var{angle} degrees. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
38 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
39 ## If the first argument @var{hax} is an axes handle, then operate on this axes |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
40 ## rather than the current axes returned by @code{gca}. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
41 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
42 ## Programming Note: Requesting a return value while also setting a specified |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
43 ## rotation will result in an error. |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
44 ## |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
45 ## @seealso{xtickangle, ytickangle, get, set} |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
46 ## @end deftypefn |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
47 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
48 function retval = ztickangle (hax, angle) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
49 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
50 switch (nargin) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
51 case 0 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
52 retval = __tickangle__ (mfilename ()); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
53 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
54 case 1 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
55 if (nargout > 0) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
56 retval = __tickangle__ (mfilename (), hax); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
57 else |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
58 __tickangle__ (mfilename (), hax); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
59 endif |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
60 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
61 case 2 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
62 if (nargout > 0) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
63 retval = __tickangle__ (mfilename (), hax, angle); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
64 else |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
65 __tickangle__ (mfilename (), hax, angle); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
66 endif |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
67 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
68 endswitch |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
69 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
70 endfunction |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
71 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
72 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
73 %!test |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
74 %! hf = figure ("visible", "off"); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
75 %! hax = axes (hf); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
76 %! unwind_protect |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
77 %! ztickangle (45); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
78 %! assert (ztickangle (), 45); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
79 %! ztickangle (hax, 90); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
80 %! a1 = ztickangle (); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
81 %! a2 = ztickangle (hax); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
82 %! assert (a1, a2); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
83 %! assert (a1, 90); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
84 %! unwind_protect_cleanup |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
85 %! close (hf); |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
86 %! end_unwind_protect |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
87 |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
88 ## Test input validation |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
89 %!error <HAX must be a handle to an axes object> ztickangle (0, 45) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
90 %!error <ANGLE must be .* scalar> ztickangle (eye (2)) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
91 %!error <ANGLE must be .* numeric> ztickangle ({90}) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
92 %!error <ANGLE must be .* finite> ztickangle (Inf) |
447beb85551d
Add ytickangle and ztickangle functions (bug #59067)
Rik <rik@octave.org>
parents:
diff
changeset
|
93 %!error <called with output query and input set value> ang = ztickangle (45) |