Mercurial > hg > octave-lyh
annotate scripts/plot/caxis.m @ 9040:dbd0c77e575e
Cleanup documentation file plot.texi
Spellcheck
Stylecheck (Mostly double spaces after periods)
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Sun, 22 Mar 2009 14:40:24 -0700 |
parents | eb63fbe60fab |
children | be55736a0783 |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 2007, 2008, 2009 David Bateman |
7189 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave 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. | |
9 ## | |
10 ## Octave 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. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Function File} {} caxis (@var{limits}) | |
21 ## @deftypefnx {Function File} {} caxis (@var{h}, @dots{}) | |
22 ## Set color axis limits for plots. | |
23 ## | |
24 ## The argument @var{limits} should be a 2 element vector specifying the | |
25 ## lower and upper limits to assign to the first and last value in the | |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
26 ## colormap. Values outside this range are clamped to the first and last |
7189 | 27 ## colormap entries. |
28 ## | |
29 ## If @var{limits} is 'auto', then automatic colormap scaling is applied, | |
30 ## whereas if @var{limits} is 'manual' the colormap scaling is set to manual. | |
31 ## | |
32 ## Called without any arguments to current color axis limits are returned. | |
33 ## | |
34 ## If an axes handle is passed as the first argument, then operate on | |
35 ## this axes rather than the current axes. | |
36 ## @end deftypefn | |
37 | |
38 function varargout = caxis (varargin) | |
39 | |
7215 | 40 [h, varargin, nargin] = __plt_get_axis_arg__ ("caxis", varargin{:}); |
7216 | 41 |
7215 | 42 oldh = gca (); |
43 unwind_protect | |
44 axes (h); | |
7189 | 45 varargout = cell (max (nargin == 0, nargout), 1); |
46 if (isempty (varargout)) | |
7215 | 47 __caxis__ (h, varargin{:}); |
7189 | 48 else |
7215 | 49 [varargout{:}] = __caxis__ (h, varargin{:}); |
7189 | 50 endif |
7215 | 51 unwind_protect_cleanup |
52 axes (oldh); | |
53 end_unwind_protect | |
7189 | 54 |
55 endfunction | |
56 | |
57 function [cmin, cmax] = __caxis__ (ca, ax, varargin) | |
58 | |
59 if (nargin == 1) | |
60 cmin = get (ca, "clim"); | |
61 if (nargout > 1) | |
62 cmax = cmin(2); | |
63 cmin = cmin(1); | |
64 endif | |
65 elseif (ischar (ax)) | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
7216
diff
changeset
|
66 if (strcmpi (ax, "auto")) |
7189 | 67 set (ca, "climmode", "auto"); |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
7216
diff
changeset
|
68 elseif (strcmpi (ax, "manual")) |
7189 | 69 set (ca, "climmode", "manual"); |
70 endif | |
71 elseif (isvector (ax)) | |
72 len = length (ax); | |
73 | |
74 if (len != 2) | |
75 error ("caxis: expecting vector with 2 elements"); | |
76 endif | |
77 | |
78 set (ca, "clim", [ax(1), ax(2)]); | |
79 else | |
80 error ("caxis: expecting no args, a string or a 2 element vector"); | |
81 endif | |
82 | |
83 if (nargin > 2) | |
84 __caxis__ (ca, varargin{:})' | |
85 endif | |
86 | |
87 endfunction | |
88 |