7017
|
1 ## Copyright (C) 1996, 1997, 2006, 2007 John W. Eaton |
6312
|
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. |
6312
|
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/>. |
6312
|
18 |
6945
|
19 ## Undocumented internal function. |
|
20 |
6312
|
21 ## -*- texinfo -*- |
|
22 ## @deftypefn {Function File} {} __img__ (@var{img}) |
|
23 ## @deftypefnx {Function File} {} __img__ (@var{x}, @var{y}, @var{img}) |
|
24 ## Generic image creation. |
|
25 ## |
|
26 ## The axis values corresponding to the matrix elements are specified in |
|
27 ## @var{x} and @var{y}. If you're not using gnuplot 4.2 or later, these |
|
28 ## variables are ignored. |
|
29 ## @end deftypefn |
|
30 |
|
31 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
|
32 ## Created: July 1994 |
|
33 ## Adapted-By: jwe |
|
34 |
7276
|
35 function h = __img__ (x, y, img, varargin) |
6312
|
36 |
|
37 newplot (); |
|
38 |
|
39 if (isempty (img)) |
|
40 error ("__img__: matrix is empty"); |
|
41 endif |
|
42 |
|
43 if (isempty (x)) |
|
44 x = [1, columns(img)]; |
|
45 endif |
|
46 |
|
47 if (isempty (y)) |
|
48 y = [1, rows(img)]; |
|
49 endif |
|
50 |
|
51 xlim = [x(1), x(end)]; |
|
52 ylim = [y(1), y(end)]; |
|
53 |
|
54 ca = gca (); |
|
55 |
7276
|
56 tmp = __go_image__ (ca, "cdata", img, "xdata", xlim, "ydata", ylim, |
|
57 varargin {:}); |
6312
|
58 |
6376
|
59 set (ca, "view", [0, 90]); |
6312
|
60 |
6420
|
61 if (strcmp (get (ca, "nextplot"), "replace")) |
|
62 set (ca, "ydir", "reverse"); |
|
63 endif |
|
64 |
6312
|
65 if (nargout > 0) |
|
66 h = tmp; |
|
67 endif |
|
68 |
|
69 endfunction |