Mercurial > hg > octave-lyh
annotate scripts/image/imagesc.m @ 9039:51dc9691f23f
Cleanup documentation files errors.texi, debug.texi, io.texi
Spellcheck
Stylecheck
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Sun, 22 Mar 2009 13:14:15 -0700 |
parents | eb63fbe60fab |
children | d1978e7364ad |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, |
8920 | 2 ## 2004, 2005, 2006, 2007, 2008 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/>. | |
1024 | 19 |
3381 | 20 ## -*- texinfo -*- |
7191 | 21 ## @deftypefn {Function File} {} imagesc (@var{a}) |
22 ## @deftypefnx {Function File} {} imagesc (@var{x}, @var{y}, @var{a}) | |
4403 | 23 ## @deftypefnx {Function File} {} imagesc (@dots{}, @var{limits}) |
7189 | 24 ## @deftypefnx {Function File} {} imagesc (@var{h}, @dots{}) |
7650 | 25 ## @deftypefnx {Function File} {@var{h} =} imagesc (@dots{}) |
7191 | 26 ## Display a scaled version of the matrix @var{a} as a color image. The |
7189 | 27 ## colormap is scaled so that the entries of the matrix occupy the entire |
28 ## colormap. If @var{limits} = [@var{lo}, @var{hi}] are given, then that | |
29 ## range is set to the 'clim' of the current axes. | |
3651 | 30 ## |
31 ## The axis values corresponding to the matrix elements are specified in | |
4403 | 32 ## @var{x} and @var{y}, either as pairs giving the minimum and maximum |
33 ## values for the respective axes, or as values for each row and column | |
7191 | 34 ## of the matrix @var{a}. |
7189 | 35 ## |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7650
diff
changeset
|
36 ## @seealso{image, imshow, caxis} |
3373 | 37 ## @end deftypefn |
559 | 38 |
3202 | 39 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
2312 | 40 ## Created: July 1994 |
41 ## Adapted-By: jwe | |
904 | 42 |
7189 | 43 function retval = imagesc (varargin) |
44 | |
45 if (nargin < 1) | |
46 print_usage (); | |
47 elseif (isscalar (varargin{1}) && ishandle (varargin{1})) | |
7208 | 48 h = varargin{1}; |
7189 | 49 if (! strcmp (get (h, "type"), "axes")) |
50 error ("imagesc: expecting first argument to be an axes object"); | |
51 endif | |
52 oldh = gca (); | |
53 unwind_protect | |
54 axes (h); | |
55 tmp = __imagesc__ (h, varargin{2:end}); | |
56 unwind_protect_cleanup | |
57 axes (oldh); | |
58 end_unwind_protect | |
59 else | |
60 tmp = __imagesc__ (gca (), varargin{:}); | |
61 endif | |
62 | |
63 if (nargout > 0) | |
64 retval = tmp; | |
65 endif | |
66 | |
67 endfunction | |
68 | |
69 function ret = __imagesc__ (ax, x, y, A, limits, DEPRECATEDZOOM) | |
559 | 70 |
6368 | 71 ## Deprecated zoom. Remove this hunk of code if old zoom argument |
72 ## is outmoded. | |
7189 | 73 if ((nargin == 3 && isscalar (y)) |
74 || (nargin == 4 && (isscalar (y) || isscalar (A))) | |
75 || (nargin == 5 && isscalar (limits)) | |
76 || nargin == 6) | |
6368 | 77 warning ("image: zoom argument ignored -- use GUI features"); |
78 endif | |
7189 | 79 if (nargin == 6) |
6368 | 80 if (isscalar (limits)) |
81 limits = DEPRECATEDZOOM; | |
82 endif | |
7189 | 83 nargin = 5; |
84 endif | |
85 if (nargin == 5 && isscalar (limits)) | |
6368 | 86 nargin = 4; |
87 endif | |
7189 | 88 if (nargin == 4 && (isscalar (y) || isscalar (A))) |
6368 | 89 if (isscalar (y)) |
90 y = A; | |
91 endif | |
7189 | 92 nargin = 3; |
6368 | 93 endif |
7189 | 94 if (nargin == 3 && isscalar (y)) |
95 nargin = 2; | |
6368 | 96 endif |
97 | |
7189 | 98 if (nargin < 2 || nargin > 5) |
6046 | 99 print_usage (); |
7189 | 100 elseif (nargin == 2) |
3651 | 101 A = x; |
6368 | 102 x = y = limits = []; |
7189 | 103 elseif (nargin == 3) |
3651 | 104 A = x; |
6368 | 105 limits = y; |
106 x = y = []; | |
7191 | 107 elseif (nargin == 4 && ! isscalar (x) && ! isscalar (y) && ! isscalar (A)) |
4403 | 108 limits = []; |
559 | 109 endif |
110 | |
7189 | 111 ret = image (ax, x, y, A); |
7471
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7208
diff
changeset
|
112 set (ret, "cdatamapping", "scaled") |
7189 | 113 |
4403 | 114 ## use given limits or guess them from the matrix |
115 if (length (limits) == 2 && limits(2) >= limits(1)) | |
7191 | 116 set (ax, "clim", limits); |
117 elseif (! isempty (limits)) | |
118 error ("expected data limits to be [lo, hi]"); | |
4403 | 119 endif |
120 | |
559 | 121 endfunction |