annotate scripts/plot/appearance/xticks.m @ 26376:00f796120a6d stable

maint: Update copyright dates in all source files.
author John W. Eaton <jwe@octave.org>
date Wed, 02 Jan 2019 16:32:43 -0500
parents 6652d3823428
children b442ec6dda5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
1 ## Copyright (C) 2017-2019 Nicholas Jankowski
24050
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
2 ##
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
3 ## 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
4 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24507
diff changeset
5 ## 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
6 ## 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
7 ## 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
8 ## (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
9 ##
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
10 ## 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
11 ## 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
12 ## 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
13 ## 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
14 ##
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
15 ## 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
16 ## 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
17 ## <https://www.gnu.org/licenses/>.
24050
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
18
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
19 ## -*- texinfo -*-
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
20 ## @deftypefn {} {@var{tickval} =} xticks
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
21 ## @deftypefnx {} {@var{mode} =} xticks ("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
22 ## @deftypefnx {} {} xticks (@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
23 ## @deftypefnx {} {} xticks ("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
24 ## @deftypefnx {} {} xticks ("manual")
24050
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
25 ## @deftypefnx {} {@dots{} =} xticks (@var{hax}, @dots{})
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
26 ## Query or set the tick values 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
27 ##
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
28 ## When called without an argument, return the current tick locations as
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
29 ## specified in the @qcode{"xtick"} axes property. These locations can be
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
30 ## changed by calling @code{xticks} with a vector of tick values. Note:
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
31 ## ascending order is not required.
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
32 ##
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
33 ## When called with argument @qcode{"mode"}, @code{xticks} returns the current
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
34 ## value of the axes property @qcode{"xtickmode"}. This property can be
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
35 ## changed by calling @code{xticks} with either @qcode{"auto"} (algorithm
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
36 ## determines tick positions) or @qcode{"manual"} (tick values remain fixed
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
37 ## regardless of axes resizing or rotation). Note: Specifying xtick values
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
38 ## will also set the property @qcode{"xtickmode"} to @qcode{"manual"}.
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
39 ##
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
40 ## 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
41 ## 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
42 ##
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
43 ## Requesting a return value when calling @code{xticks} to set a property value
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
44 ## will result in an error.
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
45 ##
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
46 ## @seealso{xticklabels, yticks, zticks, rticks, thetaticks, get, set}
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
47 ## @end deftypefn
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
48
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
49 ## Author: Nicholas Jankowski <jankowskin@asme.org>
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
50 ## Created: 2017-08-24
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
51
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
52 function retval = xticks (varargin)
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
53
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
54 hax = [];
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
55 switch (nargin)
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
56 case 0
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
57 retval = get (gca, "xtick"); # will error if no xtick exists.
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
58 return;
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
59
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
60 case 1
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
61 if (isaxes (varargin{1}))
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
62 retval = get (varargin{1}, "xtick");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
63 return;
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
64 else
24208
eec262017c6a maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 24050
diff changeset
65 arg = varargin{1};
24050
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
66 endif
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
67
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
68 case 2
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
69 if (! isaxes (varargin{1}))
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
70 error ("xticks: 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
71 endif
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
72 hax = varargin{1};
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
73 arg = varargin{2};
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 otherwise
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
76 print_usage ();
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
77
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
78 endswitch
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
79
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
80 if (isempty (hax))
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
81 hax = gca ();
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
82 endif
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
83
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
84 if (isnumeric (arg))
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
85 if (nargout > 0)
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
86 error ("xticks: too many output arguments requested");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
87 endif
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
88 ## NOTE: Matlab errors if tick points are not in ascending order. Octave
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
89 ## permits out of order tick points, so error is not produced.
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
90 set (hax, "xtick", arg);
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
91
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
92 elseif (ischar (arg))
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
93 arg = tolower (arg);
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
94 switch (arg)
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
95 case "mode"
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
96 retval = get (hax, "xtickmode");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
97
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
98 case {"auto", "manual"}
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
99 if (nargout > 0)
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
100 error ("xticks: too many output arguments requested for arg: %s",
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
101 arg);
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
102 endif
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
103 set (hax, "xtickmode", arg);
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 otherwise
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
106 error ("xticks: invalid option: %s", arg);
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 endswitch
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
109
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
110 else
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
111 print_usage ();
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
112 endif
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
113
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
114 endfunction
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
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
117 %!test
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
118 %! hf = figure ("visible", "off");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
119 %! unwind_protect
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
120 %! set (gca, "xtickmode", "auto");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
121 %! hax = gca;
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
122 %! vals1 = xticks;
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
123 %! assert (xticks (hax), vals1);
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
124 %! mode1 = xticks ("mode");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
125 %! assert (xticks (hax, "mode"), mode1);
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
126 %! xticks (hax, "manual");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
127 %! assert (xticks (hax, "mode"), "manual");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
128 %! xticks (hax, "auto");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
129 %! assert (xticks (hax, "mode"), "auto");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
130 %! xticks (hax, [1 2 3 4]);
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
131 %! assert (xticks (hax), [1 2 3 4]);
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
132 %! assert (xticks (hax, "mode"), "manual");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
133 %! unwind_protect_cleanup
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
134 %! close (hf);
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
135 %! end_unwind_protect
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
136
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
137 ## Test input validation
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
138 %!error xticks (1,2,3)
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
139 %!test
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
140 %! hf = figure ("visible", "off");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
141 %! unwind_protect
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
142 %! hax = gca;
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
143 %! fail ("xticks (-1, [0 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
144 %! fail ("tmp = xticks (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
145 %! fail ("tmp = xticks (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
146 %! fail ("tmp = xticks (hax, 'foo')", "invalid option: foo");
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
147 %! unwind_protect_cleanup
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
148 %! close (hf);
a03bb64031da Implement missing axis tick and label functions (bug #51839).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
diff changeset
149 %! end_unwind_protect