Mercurial > octave
annotate scripts/plot/appearance/zticklabels.m @ 28240:2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
* axis.m: Document that "fill" is a synonym for "normal". Place "vis3d" option
in documentation table for modes which affect aspect ratio. Add
strcmpi (opt, "fill") to decode opt and executed the same behavior as "normal".
author | Rik <rik@octave.org> |
---|---|
date | Fri, 24 Apr 2020 13:16:09 -0700 |
parents | 9f9ac219896d |
children | 3cac3ceb9629 0a5b15007766 |
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 ## |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 ## Copyright (C) 2017-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
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/>. |
24050
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
7 ## |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24507
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
24050
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
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:
24507
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
24050
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
13 ## (at your option) any later version. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
14 ## |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
18 ## GNU General Public License for more details. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
19 ## |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
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:
24507
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 ######################################################################## |
24050
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
25 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
27 ## @deftypefn {} {@var{tickval} =} zticklabels |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
28 ## @deftypefnx {} {@var{mode} =} zticklabels ("mode") |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24208
diff
changeset
|
29 ## @deftypefnx {} {} zticklabels (@var{tickval}) |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24208
diff
changeset
|
30 ## @deftypefnx {} {} zticklabels ("auto") |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24208
diff
changeset
|
31 ## @deftypefnx {} {} zticklabels ("manual") |
24050
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
32 ## @deftypefnx {} {@dots{} =} zticklabels (@var{hax}, @dots{}) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
33 ## Query or set the tick labels on the x-axis of the current axis. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
34 ## |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
35 ## When called without an argument, return a cell array of strings of the |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
36 ## current tick labels as specified in the @qcode{"zticklabel"} axes property. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
37 ## These labels can be changed by calling @code{zticklabels} with a cell array |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
38 ## of strings. Note: a vector of numbers will be mapped to a cell array of |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
39 ## strings. If fewer labels are specified than the current number of ticks, |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
40 ## blank labels will be appended to the array. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
41 ## |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
42 ## When called with argument @qcode{"mode"}, @code{zticklabels} returns the |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
43 ## current value of the axes property @qcode{"zticklabelmode"}. This property |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
44 ## can be changed by calling @code{zticklabels} with either @qcode{"auto"} |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
45 ## (algorithm determines tick labels) or @qcode{"manual"} (tick labels remain |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
46 ## fixed). Note: Specifying zticklabel values will also set the |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
47 ## @qcode{"zticklabelmode"} and @qcode{"zticks"} properties to |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
48 ## @qcode{"manual"}. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
49 ## |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
50 ## If the first argument @var{hax} is an axes handle, then operate on |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
51 ## this axis rather than the current axes returned by @code{gca}. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
52 ## |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
53 ## Requesting a return value when calling @code{xticklabels} to set a property |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
54 ## value will result in an error. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
55 ## |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
56 ## @seealso{zticks, xticklabels, zticklabels, get, set} |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
57 ## @end deftypefn |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
58 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
59 function retval = zticklabels (varargin) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
60 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
61 hax = []; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
62 switch (nargin) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
63 case 0 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
64 retval = get (gca , "zticklabel"); # will error if no zticklabel exists. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
65 return; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
66 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
67 case 1 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
68 if (isaxes (varargin{1})) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
69 retval = get (varargin{1}, "zticklabel"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
70 return; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
71 else |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24050
diff
changeset
|
72 arg = varargin{1}; |
24050
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
73 endif |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
74 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
75 case 2 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
76 if (! isaxes (varargin{1})) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
77 error ("zticklabels: HAX must be a handle to an axes object"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
78 endif |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
79 hax = varargin{1}; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
80 arg = varargin{2}; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
81 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
82 otherwise |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
83 print_usage; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
84 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
85 endswitch |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
86 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
87 if (isempty (hax)) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
88 hax = gca (); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
89 endif |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
90 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
91 if (iscell (arg) || isnumeric (arg)) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
92 if (nargout > 0) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
93 error ("zticklabels: too many output arguments requested"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
94 endif |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
95 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
96 if (isnumeric (arg)) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
97 ## NOTE: Matlab accepts a cell array, but a non-vector numeric array will |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
98 ## simply produce a black set of labels without error or warning. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
99 ## This implementation allows for a numeric array, which is handled in |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
100 ## the same order as Matlab handles a cell array |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
101 arg = num2cell (arg(:)); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
102 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
103 endif |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
104 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
105 ## Convert any numeric elements to characters, make it a 1D cell array. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
106 arg = cellfun (@num2str, arg, "UniformOutput", false)(:); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
107 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
108 ## Pad with blank cell entries if needed. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
109 arg((numel (arg) + 1):(numel (get (hax, "ztick")))) = {""}; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
110 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
111 ## Setting labels sets both ticklabel and tick mode to manual. |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
112 set (hax, "zticklabel", arg, |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
113 "zticklabelmode", "manual", |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
114 "ztickmode", "manual"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
115 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
116 elseif (ischar (arg)) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
117 arg = tolower (arg); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
118 switch (arg) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
119 case "mode" |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
120 retval = get (hax, "zticklabelmode"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
121 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
122 case {"auto", "manual"} |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
123 if (nargout > 0) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
124 error (["zticklabels: " ... |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
125 "too many output arguments requested for arg: ", arg]); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
126 endif |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
127 set (hax, "zticklabelmode", arg); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
128 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
129 otherwise |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
130 error ("zticklabels: invalid option: %s", arg); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
131 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
132 endswitch |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
133 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
134 else |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
135 print_usage; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
136 endif |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
137 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
138 endfunction |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
139 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
140 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
141 %!test |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
142 %! hf = figure ("visible", "off"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
143 %! unwind_protect |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
144 %! set (gca, "zticklabelmode", "auto"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
145 %! hax = gca; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
146 %! vals1 = zticklabels; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
147 %! assert (zticklabels (hax), vals1); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
148 %! mode1 = zticklabels ("mode"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
149 %! assert (zticklabels (hax, "mode"), mode1); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
150 %! zticklabels (hax, "manual"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
151 %! assert (zticklabels (hax, "mode"), "manual"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
152 %! zticklabels (hax, "auto"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
153 %! assert (zticks (hax, "mode"), "auto"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
154 %! zticklabels (hax, {"1", "2", "3", "4", "5", "6"}); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
155 %! assert (zticklabels (hax), {"1"; "2"; "3"; "4"; "5"; "6"}); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
156 %! assert (zticklabels (hax, "mode"), "manual"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
157 %! assert (zticks (hax, "mode"), "manual"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
158 %! unwind_protect_cleanup |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
159 %! close (hf); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
160 %! end_unwind_protect |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
161 |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
162 ## Test input validation |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
163 %!error zticklabels (1,2,3) |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
164 %!test |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
165 %! hf = figure ("visible", "off"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
166 %! unwind_protect |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
167 %! hax = gca; |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
168 %! fail ("zticklabels (-1, {})", "HAX must be a handle to an axes"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
169 %! fail ("tmp = zticklabels (hax, {'A','B'})", "too many output arguments"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
170 %! fail ("tmp = zticklabels (hax, [0, 1])", "too many output arguments"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
171 %! fail ("tmp = zticklabels (hax, 'auto')", "too many .* for arg: auto"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
172 %! fail ("tmp = zticklabels (hax, 'foo')", "invalid option: foo"); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
173 %! unwind_protect_cleanup |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
174 %! close (hf); |
a03bb64031da
Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff
changeset
|
175 %! end_unwind_protect |