annotate scripts/plot/axis.m @ 11523:fd0a3ac60b0e

update copyright notices
author John W. Eaton <jwe@octave.org>
date Fri, 14 Jan 2011 05:47:45 -0500
parents 6c8791cb35b1
children 3c6e8aaa9555
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 11201
diff changeset
1 ## Copyright (C) 1994-2011 John W. Eaton
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
2 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
3 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
4 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6765
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6765
diff changeset
8 ## your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
9 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
13 ## General Public License for more details.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
14 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6765
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6765
diff changeset
17 ## <http://www.gnu.org/licenses/>.
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
18
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
19 ## -*- texinfo -*-
10687
a8ce6bdecce5 Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents: 10557
diff changeset
20 ## @deftypefn {Function File} {} axis ()
a8ce6bdecce5 Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents: 10557
diff changeset
21 ## @deftypefnx {Function File} {} axis ([@var{x}_lo, @var{x}_hi])
a8ce6bdecce5 Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents: 10557
diff changeset
22 ## @deftypefnx {Function File} {} axis ([@var{x}_lo, @var{x}_hi, @var{y}_lo, @var{y}_hi])
a8ce6bdecce5 Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents: 10557
diff changeset
23 ## @deftypefnx {Function File} {} axis ([@var{x}_lo, @var{x}_hi, @var{y}_lo, @var{y}_hi, @var{z}_lo, @var{z}_hi])
a8ce6bdecce5 Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents: 10557
diff changeset
24 ## @deftypefnx {Function File} {} axis (@var{option})
a8ce6bdecce5 Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents: 10557
diff changeset
25 ## @deftypefnx {Function File} {} axis (@dots{}, @var{option})
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10687
diff changeset
26 ## @deftypefnx {Function File} {} axis (@var{h}, @dots{})
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10687
diff changeset
27 ## @deftypefnx {Function File} {@var{limits} =} axis ()
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
28 ## Set axis limits for plots.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3368
diff changeset
29 ##
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
30 ## The argument @var{limits} should be a 2, 4, or 6 element vector. The
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
31 ## first and second elements specify the lower and upper limits for the x
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 8953
diff changeset
32 ## axis. The third and fourth specify the limits for the y-axis, and the
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 8953
diff changeset
33 ## fifth and sixth specify the limits for the z-axis.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3368
diff changeset
34 ##
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
35 ## Without any arguments, @code{axis} turns autoscaling on.
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
36 ##
10687
a8ce6bdecce5 Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents: 10557
diff changeset
37 ## With one output argument, @code{x = axis} returns the current axes.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
38 ##
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
39 ## The vector argument specifying limits is optional, and additional
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
40 ## string arguments may be used to specify various axis properties. For
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
41 ## example,
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
42 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
43 ## @example
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
44 ## axis ([1, 2, 3, 4], "square");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
45 ## @end example
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
46 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
47 ## @noindent
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
48 ## forces a square aspect ratio, and
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
49 ##
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
50 ## @example
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
51 ## axis ("labely", "tic");
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
52 ## @end example
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
53 ##
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
54 ## @noindent
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
55 ## turns tic marks on for all axes and tic mark labels on for the y-axis
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
56 ## only.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
57 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
58 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
59 ## The following options control the aspect ratio of the axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
60 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
61 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
62 ## @item "square"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
63 ## Force a square aspect ratio.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
64 ##
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
65 ## @item "equal"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
66 ## Force x distance to equal y-distance.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
67 ##
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
68 ## @item "normal"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
69 ## Restore the balance.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
70 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
71 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
72 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
73 ## The following options control the way axis limits are interpreted.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
74 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
75 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
76 ## @item "auto"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
77 ## Set the specified axes to have nice limits around the data
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
78 ## or all if no axes are specified.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
79 ##
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
80 ## @item "manual"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
81 ## Fix the current axes limits.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
82 ##
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
83 ## @item "tight"
9277
be84e9654feb Update axis.m documentation to reflect addition of "tight" option.
Rik <rdrider0-list@yahoo.com>
parents: 9209
diff changeset
84 ## Fix axes to the limits of the data.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
85 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
86 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
87 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
88 ## The option @code{"image"} is equivalent to @code{"tight"} and
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
89 ## @code{"equal"}.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
90 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
91 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
92 ## The following options affect the appearance of tic marks.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
93 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
94 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
95 ## @item "on"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
96 ## Turn tic marks and labels on for all axes.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
97 ##
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
98 ## @item "off"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
99 ## Turn tic marks off for all axes.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
100 ##
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
101 ## @item "tic[xyz]"
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
102 ## Turn tic marks on for all axes, or turn them on for the
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
103 ## specified axes and off for the remainder.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
104 ##
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
105 ## @item "label[xyz]"
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
106 ## Turn tic labels on for all axes, or turn them on for the
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
107 ## specified axes and off for the remainder.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
108 ##
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
109 ## @item "nolabel"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
110 ## Turn tic labels off for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
111 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
112 ## Note, if there are no tic marks for an axis, there can be no labels.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
113 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
114 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
115 ## The following options affect the direction of increasing values on
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
116 ## the axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
117 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
118 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
119 ## @item "ij"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
120 ## Reverse y-axis, so lower values are nearer the top.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
121 ##
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
122 ## @item "xy"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
123 ## Restore y-axis, so higher values are nearer the top.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
124 ## @end table
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
125 ##
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
126 ## If an axes handle is passed as the first argument, then operate on
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
127 ## this axes rather than the current axes.
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
128 ## @end deftypefn
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
129
2314
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
130 ## Author: jwe
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
131
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
132 function varargout = axis (varargin)
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
133
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
134 [h, varargin, nargin] = __plt_get_axis_arg__ ("axis", varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
135
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
136 oldh = gca ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
137 unwind_protect
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
138 axes (h);
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
139 varargout = cell (max (nargin == 0, nargout), 1);
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
140 if (isempty (varargout))
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
141 __axis__ (h, varargin{:});
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
142 else
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
143 [varargout{:}] = __axis__ (h, varargin{:});
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
144 endif
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
145 unwind_protect_cleanup
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
146 axes (oldh);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
147 end_unwind_protect
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
148
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
149 endfunction
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
150
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
151 function curr_axis = __axis__ (ca, ax, varargin)
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
152
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
153 if (nargin == 1)
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
154 if (nargout == 0)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
155 set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
156 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
157 xlim = get (ca, "xlim");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
158 ylim = get (ca, "ylim");
9427
7b74a7fd4761 axis: return 4-element vector for 2-d view
John W. Eaton <jwe@octave.org>
parents: 9357
diff changeset
159 view = get (ca, "view");
7b74a7fd4761 axis: return 4-element vector for 2-d view
John W. Eaton <jwe@octave.org>
parents: 9357
diff changeset
160 if (view(2) == 90)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
161 curr_axis = [xlim, ylim];
9427
7b74a7fd4761 axis: return 4-element vector for 2-d view
John W. Eaton <jwe@octave.org>
parents: 9357
diff changeset
162 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
163 zlim = get (ca, "zlim");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
164 curr_axis = [xlim, ylim, zlim];
9427
7b74a7fd4761 axis: return 4-element vector for 2-d view
John W. Eaton <jwe@octave.org>
parents: 9357
diff changeset
165 endif
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
166 endif
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
167
5443
ec8c33dcd1bf [project @ 2005-09-08 01:40:57 by jwe]
jwe
parents: 5307
diff changeset
168 elseif (ischar (ax))
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
169 len = length (ax);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
170
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
171 ## 'matrix mode' to reverse the y-axis
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
172 if (strcmpi (ax, "ij"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
173 set (ca, "ydir", "reverse");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
174 elseif (strcmpi (ax, "xy"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
175 set (ca, "ydir", "normal");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
176
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
177 ## aspect ratio
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
178 elseif (strcmpi (ax, "image"))
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
179 __axis__ (ca, "equal")
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
180 __do_tight_option__ (ca);
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
181 elseif (strcmpi (ax, "square"))
10532
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
182 set (ca, "plotboxaspectratio", [1, 1, 1]);
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
183 elseif (strcmp (ax, "equal"))
11001
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
184 if (strcmp (get (get (ca, "parent"), "__backend__"), "gnuplot"))
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
185 ## FIXME - gnuplot applies the aspect ratio activepostionproperty.
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
186 set (ca, "activepositionproperty", "position");
11185
5b48695f3c13 Making 'axis equal' equivalent to 'daspect([1,1,1])'
Konstantinos Poulios <logari81@googlemail.com>
parents: 11183
diff changeset
187 ## The following line is a trick used to trigger the recalculation of
5b48695f3c13 Making 'axis equal' equivalent to 'daspect([1,1,1])'
Konstantinos Poulios <logari81@googlemail.com>
parents: 11183
diff changeset
188 ## aspect related magnitudes even if the aspect ratio is the same
5b48695f3c13 Making 'axis equal' equivalent to 'daspect([1,1,1])'
Konstantinos Poulios <logari81@googlemail.com>
parents: 11183
diff changeset
189 ## (useful with the x11 gnuplot terminal after a window resize)
5b48695f3c13 Making 'axis equal' equivalent to 'daspect([1,1,1])'
Konstantinos Poulios <logari81@googlemail.com>
parents: 11183
diff changeset
190 set (ca, "dataaspectratiomode", "auto");
11001
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
191 endif
11185
5b48695f3c13 Making 'axis equal' equivalent to 'daspect([1,1,1])'
Konstantinos Poulios <logari81@googlemail.com>
parents: 11183
diff changeset
192 set (ca, "dataaspectratio", [1, 1, 1])
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
193 elseif (strcmpi (ax, "normal"))
10557
e86651d2fde5 axis.m: For 'axis normal' restore plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
194 set (ca, "plotboxaspectratio", [1, 1, 1])
10226
2884758e265b Replace dataaspectratio props with plotboxaspectratio props.
Ben Abbott <bpabbott@mac.com>
parents: 9427
diff changeset
195 set (ca, "plotboxaspectratiomode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
196
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
197 ## axis limits
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
198 elseif (len >= 4 && strcmpi (ax(1:4), "auto"))
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
199 if (len > 4)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
200 if (any (ax == "x"))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
201 set (ca, "xlimmode", "auto");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
202 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
203 if (any (ax == "y"))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
204 set (ca, "ylimmode", "auto");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
205 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
206 if (any (ax == "z"))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
207 set (ca, "zlimmode", "auto");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
208 endif
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
209 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
210 set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
211 endif
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
212 elseif (strcmpi (ax, "manual"))
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
213 ## fixes the axis limits, like axis(axis) should;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
214 set (ca, "xlimmode", "manual", "ylimmode", "manual", "zlimmode", "manual");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
215 elseif (strcmpi (ax, "tight"))
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
216 ## sets the axis limits to the min and max of all data.
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
217 __do_tight_option__ (ca);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
218 ## tic marks
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
219 elseif (strcmpi (ax, "on") || strcmpi (ax, "tic"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
220 set (ca, "xtickmode", "auto", "ytickmode", "auto", "ztickmode", "auto");
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
221 if (strcmpi (ax, "on"))
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
222 set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
223 "zticklabelmode", "auto");
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
224 endif
6765
e6b528a3a2a9 [project @ 2007-06-28 15:25:43 by jwe]
jwe
parents: 6746
diff changeset
225 set (ca, "visible", "on");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
226 elseif (strcmpi (ax, "off"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
227 set (ca, "xtick", [], "ytick", [], "ztick", []);
6765
e6b528a3a2a9 [project @ 2007-06-28 15:25:43 by jwe]
jwe
parents: 6746
diff changeset
228 set (ca, "visible", "off");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
229 elseif (len > 3 && strcmpi (ax(1:3), "tic"))
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
230 if (any (ax == "x"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
231 set (ca, "xtickmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
232 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
233 set (ca, "xtick", []);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
234 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
235 if (any (ax == "y"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
236 set (ca, "ytickmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
237 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
238 set (ca, "ytick", []);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
239 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
240 if (any (ax == "z"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
241 set (ca, "ztickmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
242 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
243 set (ca, "ztick", []);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
244 endif
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
245 elseif (strcmpi (ax, "label"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
246 set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
247 "zticklabelmode", "auto");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
248 elseif (strcmpi (ax, "nolabel"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
249 set (ca, "xticklabel", "", "yticklabel", "", "zticklabel", "");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
250 elseif (len > 5 && strcmpi (ax(1:5), "label"))
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
251 if (any (ax == "x"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
252 set (ca, "xticklabelmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
253 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
254 set (ca, "xticklabel", "");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
255 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
256 if (any (ax == "y"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
257 set (ca, "yticklabelmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
258 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
259 set (ca, "yticklabel", "");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
260 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
261 if (any (ax == "z"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
262 set (ca, "zticklabelmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
263 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
264 set (ca, "zticklabel", "");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
265 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
266
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
267 else
4259
0493a367de6f [project @ 2003-01-02 17:30:14 by jwe]
jwe
parents: 4030
diff changeset
268 warning ("unknown axis option '%s'", ax);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
269 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
270
4030
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 3979
diff changeset
271 elseif (isvector (ax))
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
272
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
273 len = length (ax);
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
274
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
275 if (len != 2 && len != 4 && len != 6)
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
276 error ("axis: expecting vector with 2, 4, or 6 elements");
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
277 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
278
5627
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
279 for i = 1:2:len
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
280 if (ax(i) == ax(i+1))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10532
diff changeset
281 error ("axis: limits(%d) cannot equal limits(%d)", i, i+1);
5627
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
282 endif
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
283 endfor
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
284
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
285 if (len > 1)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
286 set (ca, "xlim", [ax(1), ax(2)]);
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
287 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
288
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
289 if (len > 3)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
290 set (ca, "ylim", [ax(3), ax(4)]);
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
291 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
292
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
293 if (len > 5)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
294 set (ca, "zlim", [ax(5), ax(6)]);
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
295 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
296
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
297 else
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
298 error ("axis: expecting no args, or a vector with 2, 4, or 6 elements");
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
299 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
300
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
301 if (! isempty (varargin))
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
302 __axis__ (ca, varargin{:});
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
303 endif
6447
3f79532415b5 [project @ 2007-03-24 00:00:31 by jwe]
jwe
parents: 6257
diff changeset
304
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
305 endfunction
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
306
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
307 function lims = __get_tight_lims__ (ca, ax)
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
308
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
309 ## Get the limits for axis ("tight").
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
310 ## AX should be one of "x", "y", or "z".
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
311 kids = findobj (ca, "-property", strcat (ax, "data"));
11174
2114867f2a50 axis.m: Exclude hggroup {x,y,z}data properties when determing tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents: 11001
diff changeset
312 ## Since contours set the cdata for the patches to the hggroup zdata property, exclude
2114867f2a50 axis.m: Exclude hggroup {x,y,z}data properties when determing tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents: 11001
diff changeset
313 ## hgroups when determining the tight limits.
2114867f2a50 axis.m: Exclude hggroup {x,y,z}data properties when determing tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents: 11001
diff changeset
314 hg_kids = findobj (ca, "-property", strcat (ax, "data"), "type", "hggroup");
2114867f2a50 axis.m: Exclude hggroup {x,y,z}data properties when determing tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents: 11001
diff changeset
315 kids = setdiff (kids, hg_kids);
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
316 if (isempty (kids))
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
317 ## Return the current limits.
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
318 lims = get (ca, strcat (ax, "lim"));
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
319 else
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
320 data = get (kids, strcat (ax, "data"));
11201
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
321 scale = get (ca, strcat (ax, "scale"));
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
322 if (strcmp (scale, "log"))
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
323 data(data<=0) = NaN;
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
324 end
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
325 if (iscell (data))
9317
96abf8f7e5b6 axis.m: Fix bug for 'axis tight' with multiple lines, modify demo.
Ben Abbott <bpabbott@mac.com>
parents: 9277
diff changeset
326 data = data (find (! cellfun (@isempty, data)));
96abf8f7e5b6 axis.m: Fix bug for 'axis tight' with multiple lines, modify demo.
Ben Abbott <bpabbott@mac.com>
parents: 9277
diff changeset
327 if (! isempty (data))
11191
01ddaedd6ad5 Reverse changeset b1f4bdc276b6. Use all lower case for "uniformoutput" option.
Rik <octave@nomad.inbox5.com>
parents: 11185
diff changeset
328 lims_min = min (cellfun (@min, cellfun (@min, data, 'uniformoutput', false)(:)));
01ddaedd6ad5 Reverse changeset b1f4bdc276b6. Use all lower case for "uniformoutput" option.
Rik <octave@nomad.inbox5.com>
parents: 11185
diff changeset
329 lims_max = max (cellfun (@max, cellfun (@max, data, 'uniformoutput', false)(:)));
9357
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
330 lims = [lims_min, lims_max];
9317
96abf8f7e5b6 axis.m: Fix bug for 'axis tight' with multiple lines, modify demo.
Ben Abbott <bpabbott@mac.com>
parents: 9277
diff changeset
331 else
96abf8f7e5b6 axis.m: Fix bug for 'axis tight' with multiple lines, modify demo.
Ben Abbott <bpabbott@mac.com>
parents: 9277
diff changeset
332 lims = [0, 1];
96abf8f7e5b6 axis.m: Fix bug for 'axis tight' with multiple lines, modify demo.
Ben Abbott <bpabbott@mac.com>
parents: 9277
diff changeset
333 endif
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
334 else
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
335 lims = [min(data(:)), max(data(:))];
8610
85c9906abfd1 use endif and endfor instead of end
John W. Eaton <jwe@octave.org>
parents: 8507
diff changeset
336 endif
85c9906abfd1 use endif and endfor instead of end
John W. Eaton <jwe@octave.org>
parents: 8507
diff changeset
337 endif
9357
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
338
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
339 endfunction
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
340
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
341 function __do_tight_option__ (ca)
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
342
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
343 set (ca,
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
344 "xlim", __get_tight_lims__ (ca, "x"),
11183
ac6a199be45e Leave zlim unchanged during 'axis tight' on 2D plots
Konstantinos Poulios <logari81@googlemail.com>
parents: 11174
diff changeset
345 "ylim", __get_tight_lims__ (ca, "y"));
ac6a199be45e Leave zlim unchanged during 'axis tight' on 2D plots
Konstantinos Poulios <logari81@googlemail.com>
parents: 11174
diff changeset
346 if __calc_dimensions__ (ca) > 2
ac6a199be45e Leave zlim unchanged during 'axis tight' on 2D plots
Konstantinos Poulios <logari81@googlemail.com>
parents: 11174
diff changeset
347 set (ca, "zlim", __get_tight_lims__ (ca, "z"));
ac6a199be45e Leave zlim unchanged during 'axis tight' on 2D plots
Konstantinos Poulios <logari81@googlemail.com>
parents: 11174
diff changeset
348 endif
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
349
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
350 endfunction
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
351
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
352 %!demo
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
353 %! t=0:0.01:2*pi; x=sin(t);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
354 %!
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
355 %! subplot(221);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
356 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
357 %! title("normal plot");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
358 %!
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
359 %! subplot(222);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
360 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
361 %! title("square plot");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
362 %! axis("square");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
363 %!
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
364 %! subplot(223);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
365 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
366 %! title("equal plot");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
367 %! axis("equal");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
368 %!
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
369 %! subplot(224);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
370 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
371 %! title("normal plot again");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
372 %! axis("normal");
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
373
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
374 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
375 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
376 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
377 %! subplot(121);
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
378 %! plot(t, x);
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
379 %! title("ij plot");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
380 %! axis("ij");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
381 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
382 %! subplot(122);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
383 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
384 %! title("xy plot");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
385 %! axis("xy");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
386
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
387 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
388 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
389 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
390 %! subplot(331);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
391 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
392 %! title("x tics and labels");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
393 %! axis("ticx");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
394 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
395 %! subplot(332);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
396 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
397 %! title("y tics and labels");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
398 %! axis("ticy");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
399 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
400 %! subplot(333);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
401 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
402 %! title("axis off");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
403 %! axis("off");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
404 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
405 %! subplot(334);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
406 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
407 %! title("x and y tics, x labels");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
408 %! axis("labelx","tic");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
409 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
410 %! subplot(335);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
411 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
412 %! title("x and y tics, y labels");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
413 %! axis("labely","tic");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
414 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
415 %! subplot(336);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
416 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
417 %! title("all tics but no labels");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
418 %! axis("nolabel","tic");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
419 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
420 %! subplot(337);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
421 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
422 %! title("x tics, no labels");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
423 %! axis("nolabel","ticx");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
424 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
425 %! subplot(338);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
426 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
427 %! title("y tics, no labels");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
428 %! axis("nolabel","ticy");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
429 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
430 %! subplot(339);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
431 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
432 %! title("all tics and labels");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
433 %! axis("on");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
434
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
435 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
436 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
437 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
438 %! subplot(321);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
439 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
440 %! title("axes at [0 3 0 1]")
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
441 %! axis([0,3,0,1]);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
442 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
443 %! subplot(322);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
444 %! plot(t, x);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
445 %! title("auto");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
446 %! axis("auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
447 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
448 %! subplot(323);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
449 %! plot(t, x, ";sine [0:2pi];"); hold on;
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
450 %! plot(-3:3,-3:3, ";line (-3,-3)->(3,3);"); hold off;
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
451 %! title("manual");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
452 %! axis("manual");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
453 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
454 %! subplot(324);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
455 %! plot(t, x, ";sine [0:2pi];");
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
456 %! title("axes at [0 3 0 1], then autox");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
457 %! axis([0,3,0,1]); axis("autox");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
458 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
459 %! subplot(325);
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
460 %! plot(t, x, ";sine [0:2p];");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
461 %! axis([3,6,0,1]); axis("autoy");
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
462 %! title("axes at [3 6 0 1], then autoy");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
463 %!
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
464 %! subplot(326);
9317
96abf8f7e5b6 axis.m: Fix bug for 'axis tight' with multiple lines, modify demo.
Ben Abbott <bpabbott@mac.com>
parents: 9277
diff changeset
465 %! plot(t, sin(t), t, -2*sin(t/2))
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
466 %! axis("tight");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
467 %! title("tight");
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
468
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
469 %!demo
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
470 %! clf
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
471 %! axis image
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
472 %! x=0:0.1:10;
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
473 %! plot(x,sin(x))
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
474 %! axis image
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
475 %! title("image")
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
476
9357
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
477 %!demo
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
478 %! clf
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
479 %! [x,y,z] = peaks(50);
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
480 %! x1 = max(x(:));
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
481 %! pcolor(x-x1,y-x1/2,z)
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
482 %! hold on
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
483 %! [x,y,z] = sombrero;
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
484 %! s = x1/max(x(:));
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
485 %! pcolor(s*x+x1,s*y+x1/2,5*z)
95ec56601497 axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents: 9317
diff changeset
486 %! axis tight
8953
a6945f92b868 __go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
487
11201
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
488 %!demo
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
489 %! clf
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
490 %! x = -10:10;
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
491 %! plot (x, x, x, -x)
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
492 %! set (gca, "yscale", "log")
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
493 %! legend ({"x >= 1", "x <= 1"}, "location", "north")
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
494 %! title ("ylim = [1, 10]")
6c8791cb35b1 __go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents: 11191
diff changeset
495