]> Creatis software - CreaPhase.git/blob - octave_packages/plot-1.1.0/tics.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / plot-1.1.0 / tics.m
1 ## Copyright (C) 2002 Paul Kienzle <pkienzle@users.sf.net>
2 ## Copyright (C) 2005 Dmitri A. Sergatskov <dasergatskov@gmail.com>
3 ## Copyright (C) 2007 Russel Valentine
4 ## Copyright (C) 2007 Peter Gustafson
5 ## This program is in the public domain
6
7 ## -*- texinfo -*-
8 ## @deftypefn {Function File} {} tics (@var{axis}, [@var{pos1}, @var{pos2}, @dots{}], [@var{lab1}, @var{lab2}, @dots{}],)
9 ## Explicitly set the tic positions and labels for the given axis.
10 ##
11 ## @var{axis} must be 'x', 'y' or 'z'.
12 ##
13 ## If no positions or labels are given, then restore the default.
14 ## If positions are given but no labels, use those positions with the
15 ## normal labels. If positions and labels are given, each position
16 ## labeled with the corresponding row from the label matrix.
17 ##
18 ## @end deftypefn
19
20 function tics (axis, pos, lab)
21
22   if ( nargin < 1 || nargin > 3 )
23     print_usage;
24   endif
25
26   t = lower (axis);
27   if (t ~= "x" && t ~= "y" && t ~= "z")
28     error ("First input argument must be one of 'x', 'y' or 'z'");
29   endif
30
31   if (nargin == 1)
32     set (gca(), [t, "tick"], []);
33     set (gca(), [t, "tickmode"], "auto");
34     set (gca(), [t, "ticklabel"], "");
35     set (gca(), [t, "ticklabelmode"], "auto");
36   elseif (nargin == 2)
37     set (gca(), [t, "tick"], pos);
38     set (gca(), [t, "ticklabel"], "");
39     set (gca(), [t, "ticklabelmode"], "auto");
40   elseif (nargin == 3)
41     set (gca(), [t, "tick"], pos);
42     set (gca(), [t, "ticklabel"], lab);
43   else
44     ## we should never get here anyway
45     print_usage;
46   endif
47
48 endfunction