1 ## Copyright (C) 1998, 2000, 2004, 2005, 2007
2 ## Auburn University. All rights reserved.
5 ## This program is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} __axis_margin__ (@var{axdata})
21 ## Determine axis limits for 2-D data (column vectors); leaves a 10%
22 ## margin around the plots.
23 ## Inserts margins of +/- 0.1 if data is one-dimensional
24 ## (or a single point).
29 ## @var{n} by 2 matrix of data [@var{x}, @var{y}].
35 ## Vector of axis limits appropriate for call to @command{axis} function.
39 function axvec = __axis_margin__ (axdata)
41 ## compute axis limits
44 delv = (maxv-minv)/2; # breadth of the plot
45 midv = (minv + maxv)/2; # midpoint of the plot
47 axdel = [-0.1, 0.1]; # default plot width (if less than 2-d data)
51 axdel = [-0.1*midv, 0.1*midv];
54 ## they're at least one-dimensional
55 tolv = max(1e-8, 1e-8*abs(midv));
56 if (abs (delv) >= tolv)
57 axdel = 1.1*[-delv,delv];
61 axvec = axmid + axdel;