Mercurial > hg > octave-nkf
annotate scripts/image/imagesc.m @ 11589:b0084095098e
missing semicolons in script files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 18:26:09 -0500 |
parents | fd0a3ac60b0e |
children | 5f0bb45e615c |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 1994-2011 John W. Eaton |
2313 | 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 | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
2313 | 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 | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
1024 | 18 |
3381 | 19 ## -*- texinfo -*- |
11471
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
20 ## @deftypefn {Function File} {} imagesc (@var{A}) |
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
21 ## @deftypefnx {Function File} {} imagesc (@var{x}, @var{y}, @var{A}) |
4403 | 22 ## @deftypefnx {Function File} {} imagesc (@dots{}, @var{limits}) |
7189 | 23 ## @deftypefnx {Function File} {} imagesc (@var{h}, @dots{}) |
7650 | 24 ## @deftypefnx {Function File} {@var{h} =} imagesc (@dots{}) |
11471
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
25 ## Display a scaled version of the matrix @var{A} as a color image. The |
7189 | 26 ## colormap is scaled so that the entries of the matrix occupy the entire |
27 ## colormap. If @var{limits} = [@var{lo}, @var{hi}] are given, then that | |
28 ## range is set to the 'clim' of the current axes. | |
3651 | 29 ## |
30 ## The axis values corresponding to the matrix elements are specified in | |
4403 | 31 ## @var{x} and @var{y}, either as pairs giving the minimum and maximum |
32 ## values for the respective axes, or as values for each row and column | |
11471
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
33 ## of the matrix @var{A}. |
7189 | 34 ## |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7650
diff
changeset
|
35 ## @seealso{image, imshow, caxis} |
3373 | 36 ## @end deftypefn |
559 | 37 |
3202 | 38 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
2312 | 39 ## Created: July 1994 |
40 ## Adapted-By: jwe | |
904 | 41 |
7189 | 42 function retval = imagesc (varargin) |
43 | |
44 if (nargin < 1) | |
45 print_usage (); | |
46 elseif (isscalar (varargin{1}) && ishandle (varargin{1})) | |
7208 | 47 h = varargin{1}; |
7189 | 48 if (! strcmp (get (h, "type"), "axes")) |
49 error ("imagesc: expecting first argument to be an axes object"); | |
50 endif | |
51 oldh = gca (); | |
52 unwind_protect | |
53 axes (h); | |
54 tmp = __imagesc__ (h, varargin{2:end}); | |
55 unwind_protect_cleanup | |
56 axes (oldh); | |
57 end_unwind_protect | |
58 else | |
59 tmp = __imagesc__ (gca (), varargin{:}); | |
60 endif | |
61 | |
62 if (nargout > 0) | |
63 retval = tmp; | |
64 endif | |
65 | |
66 endfunction | |
67 | |
68 function ret = __imagesc__ (ax, x, y, A, limits, DEPRECATEDZOOM) | |
559 | 69 |
6368 | 70 ## Deprecated zoom. Remove this hunk of code if old zoom argument |
71 ## is outmoded. | |
7189 | 72 if ((nargin == 3 && isscalar (y)) |
73 || (nargin == 4 && (isscalar (y) || isscalar (A))) | |
74 || (nargin == 5 && isscalar (limits)) | |
75 || nargin == 6) | |
6368 | 76 warning ("image: zoom argument ignored -- use GUI features"); |
77 endif | |
7189 | 78 if (nargin == 6) |
6368 | 79 if (isscalar (limits)) |
80 limits = DEPRECATEDZOOM; | |
81 endif | |
7189 | 82 nargin = 5; |
83 endif | |
84 if (nargin == 5 && isscalar (limits)) | |
6368 | 85 nargin = 4; |
86 endif | |
7189 | 87 if (nargin == 4 && (isscalar (y) || isscalar (A))) |
6368 | 88 if (isscalar (y)) |
89 y = A; | |
90 endif | |
7189 | 91 nargin = 3; |
6368 | 92 endif |
7189 | 93 if (nargin == 3 && isscalar (y)) |
94 nargin = 2; | |
6368 | 95 endif |
96 | |
7189 | 97 if (nargin < 2 || nargin > 5) |
6046 | 98 print_usage (); |
7189 | 99 elseif (nargin == 2) |
3651 | 100 A = x; |
6368 | 101 x = y = limits = []; |
7189 | 102 elseif (nargin == 3) |
3651 | 103 A = x; |
6368 | 104 limits = y; |
105 x = y = []; | |
7191 | 106 elseif (nargin == 4 && ! isscalar (x) && ! isscalar (y) && ! isscalar (A)) |
4403 | 107 limits = []; |
559 | 108 endif |
109 | |
7189 | 110 ret = image (ax, x, y, A); |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
111 set (ret, "cdatamapping", "scaled"); |
7189 | 112 |
4403 | 113 ## use given limits or guess them from the matrix |
114 if (length (limits) == 2 && limits(2) >= limits(1)) | |
7191 | 115 set (ax, "clim", limits); |
116 elseif (! isempty (limits)) | |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
11471
diff
changeset
|
117 error ("imagesc: expected data LIMITS to be [lo, hi]"); |
4403 | 118 endif |
119 | |
559 | 120 endfunction |