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