File: tics.m

package info (click to toggle)
octave-plot 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 104 kB
  • sloc: makefile: 1
file content (48 lines) | stat: -rw-r--r-- 1,519 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
## Copyright (C) 2002 Paul Kienzle <pkienzle@users.sf.net>
## Copyright (C) 2005 Dmitri A. Sergatskov <dasergatskov@gmail.com>
## Copyright (C) 2007 Russel Valentine
## Copyright (C) 2007 Peter Gustafson
## This program is in the public domain

## -*- texinfo -*-
## @deftypefn {Function File} {} tics (@var{axis}, [@var{pos1}, @var{pos2}, @dots{}], [@var{lab1}, @var{lab2}, @dots{}],)
## Explicitly set the tic positions and labels for the given axis.
##
## @var{axis} must be 'x', 'y' or 'z'.
##
## If no positions or labels are given, then restore the default.
## If positions are given but no labels, use those positions with the
## normal labels. If positions and labels are given, each position
## labeled with the corresponding row from the label matrix.
##
## @end deftypefn

function tics (axis, pos, lab)

  if ( nargin < 1 || nargin > 3 )
    print_usage;
  endif

  t = lower (axis);
  if (t ~= "x" && t ~= "y" && t ~= "z")
    error ("First input argument must be one of 'x', 'y' or 'z'");
  endif

  if (nargin == 1)
    set (gca(), [t, "tick"], []);
    set (gca(), [t, "tickmode"], "auto");
    set (gca(), [t, "ticklabel"], "");
    set (gca(), [t, "ticklabelmode"], "auto");
  elseif (nargin == 2)
    set (gca(), [t, "tick"], pos);
    set (gca(), [t, "ticklabel"], "");
    set (gca(), [t, "ticklabelmode"], "auto");
  elseif (nargin == 3)
    set (gca(), [t, "tick"], pos);
    set (gca(), [t, "ticklabel"], lab);
  else
    ## we should never get here anyway
    print_usage;
  endif

endfunction