annotate scripts/image/imagesc.m @ 27918:b442ec6dda5c

use centralized file for copyright info for individual contributors * COPYRIGHT.md: New file. * In most other files, use "Copyright (C) YYYY-YYYY The Octave Project Developers" instead of tracking individual names in separate source files. The motivation is to reduce the effort required to update the notices each year. Until now, the Octave source files contained copyright notices that list individual contributors. I adopted these file-scope copyright notices because that is what everyone was doing 30 years ago in the days before distributed version control systems. But now, with many contributors and modern version control systems, having these file-scope copyright notices causes trouble when we update copyright years or refactor code. Over time, the file-scope copyright notices may become outdated as new contributions are made or code is moved from one file to another. Sometimes people contribute significant patches but do not add a line claiming copyright. Other times, people add a copyright notice for their contribution but then a later refactoring moves part or all of their contribution to another file and the notice is not moved with the code. As a practical matter, moving such notices is difficult -- determining what parts are due to a particular contributor requires a time-consuming search through the project history. Even managing the yearly update of copyright years is problematic. We have some contributors who are no longer living. Should we update the copyright dates for their contributions when we release new versions? Probably not, but we do still want to claim copyright for the project as a whole. To minimize the difficulty of maintaining the copyright notices, I would like to change Octave's sources to use what is described here: https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html in the section "Maintaining centralized copyright notices": The centralized notice approach consolidates all copyright notices in a single location, usually a top-level file. This file should contain all of the copyright notices provided project contributors, unless the contribution was clearly insignificant. It may also credit -- without a copyright notice -- anyone who helped with the project but did not contribute code or other copyrighted material. This approach captures less information about contributions within individual files, recognizing that the DVCS is better equipped to record those details. As we mentioned before, it does have one disadvantage as compared to the file-scope approach: if a single file is separated from the distribution, the recipient won't see the contributors' copyright notices. But this can be easily remedied by including a single copyright notice in each file's header, pointing to the top-level file: Copyright YYYY-YYYY The Octave Project Developers See the COPYRIGHT file at the top-level directory of this distribution or at https://octave.org/COPYRIGHT.html. followed by the usual GPL copyright statement. For more background, see the discussion here: https://lists.gnu.org/archive/html/octave-maintainers/2020-01/msg00009.html Most files in the following directories have been skipped intentinally in this changeset: doc libgui/qterminal liboctave/external m4
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 15:38:17 -0500
parents 00f796120a6d
children 1891570abac8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1 ## Copyright (C) 1994-2019 The Octave Project Developers
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
2 ##
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ## or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
5 ##
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
6 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
7 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
8 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24057
diff changeset
9 ## Octave is free software: you can redistribute it and/or modify it
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
10 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24057
diff changeset
11 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22369
diff changeset
12 ## (at your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
13 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
14 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22369
diff changeset
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22369
diff changeset
17 ## GNU General Public License for more details.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
18 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
19 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6368
diff changeset
20 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24057
diff changeset
21 ## <https://www.gnu.org/licenses/>.
1024
56520a75b5b3 [project @ 1995-01-11 20:30:04 by jwe]
jwe
parents: 904
diff changeset
22
3381
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3373
diff changeset
23 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
24 ## @deftypefn {} {} imagesc (@var{img})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
25 ## @deftypefnx {} {} imagesc (@var{x}, @var{y}, @var{img})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
26 ## @deftypefnx {} {} imagesc (@dots{}, @var{climits})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
27 ## @deftypefnx {} {} imagesc (@dots{}, "@var{prop}", @var{val}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
28 ## @deftypefnx {} {} imagesc ("@var{prop1}", @var{val1}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
29 ## @deftypefnx {} {} imagesc (@var{hax}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
30 ## @deftypefnx {} {@var{h} =} imagesc (@dots{})
20158
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
31 ## Display a scaled version of the matrix @var{img} as a color image.
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
32 ##
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
33 ## The colormap is scaled so that the entries of the matrix occupy the entire
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
34 ## colormap. If @code{@var{climits} = [@var{lo}, @var{hi}]} is given, then
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
35 ## that range is set to the @qcode{"clim"} of the current axes.
3651
c2305b99fbd7 [project @ 2000-03-31 07:12:29 by jwe]
jwe
parents: 3457
diff changeset
36 ##
25856
9578af67a0d4 Document that image x/ydata indicate the centers of corner pixels (bug #54610).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
37 ## @var{x} and @var{y} are optional 2-element vectors, @w{@code{[min, max]}},
9578af67a0d4 Document that image x/ydata indicate the centers of corner pixels (bug #54610).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
38 ## which specify the coordinates of the centers of the corner pixels.
9578af67a0d4 Document that image x/ydata indicate the centers of corner pixels (bug #54610).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
39 ## If a range is specified as @w{@code{[max, min]}} then the image will be
9578af67a0d4 Document that image x/ydata indicate the centers of corner pixels (bug #54610).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
40 ## reversed along that axis. For convenience, @var{x} and @var{y} may be
9578af67a0d4 Document that image x/ydata indicate the centers of corner pixels (bug #54610).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
41 ## specified as N-element vectors matching the length of the data in @var{img}.
25980
221c039aa415 Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25856
diff changeset
42 ## However, only the first and last elements will be used to determine
221c039aa415 Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25856
diff changeset
43 ## the image limits.
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
44 ##
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11589
diff changeset
45 ## The optional return value @var{h} is a graphics handle to the image.
17689
dd8db3f1c1da doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents: 17281
diff changeset
46 ##
dd8db3f1c1da doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents: 17281
diff changeset
47 ## Calling Forms: The @code{imagesc} function can be called in two forms:
dd8db3f1c1da doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents: 17281
diff changeset
48 ## High-Level and Low-Level. When invoked with normal options, the High-Level
dd8db3f1c1da doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents: 17281
diff changeset
49 ## form is used which first calls @code{newplot} to prepare the graphic figure
dd8db3f1c1da doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents: 17281
diff changeset
50 ## and axes. When the only inputs to @code{image} are property/value pairs
dd8db3f1c1da doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents: 17281
diff changeset
51 ## the Low-Level form is used which creates a new instance of an image object
dd8db3f1c1da doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents: 17281
diff changeset
52 ## and inserts it in the current axes.
dd8db3f1c1da doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents: 17281
diff changeset
53 ##
8286
6f2d95255911 fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7650
diff changeset
54 ## @seealso{image, imshow, caxis}
3373
36405da8e173 [project @ 1999-11-23 20:54:17 by jwe]
jwe
parents: 3225
diff changeset
55 ## @end deftypefn
559
4e826edfbc56 [project @ 1994-07-25 22:18:28 by jwe]
jwe
parents:
diff changeset
56
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 2847
diff changeset
57 ## Author: Tony Richardson <arichard@stark.cc.oh.us>
2312
204cc7db6f4a [project @ 1996-07-11 21:20:36 by jwe]
jwe
parents: 2311
diff changeset
58 ## Created: July 1994
204cc7db6f4a [project @ 1996-07-11 21:20:36 by jwe]
jwe
parents: 2311
diff changeset
59 ## Adapted-By: jwe
904
3470f1e25a79 [project @ 1994-11-09 21:22:15 by jwe]
jwe
parents: 559
diff changeset
60
15683
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
61 function h = imagesc (varargin)
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
62
17692
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
63 [hax, varargin, nargin] = __plt_get_axis_arg__ ("imagesc", varargin{:});
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
64
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
65 chararg = find (cellfun ("isclass", varargin, "char"), 1, "first");
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
66
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
67 do_new = true;
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
68 if (nargin == 0)
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
69 print_usage ();
17692
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
70 elseif (chararg == 1)
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
71 ## Low-Level syntax
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
72 do_new = false;
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
73 img = x = y = climits = [];
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
74 elseif (nargin == 1 || chararg == 2)
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
75 img = varargin{1};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
76 x = y = climits = [];
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
77 elseif (nargin == 2 || chararg == 3)
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
78 img = varargin{1};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
79 climits = varargin{2};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
80 x = y = [];
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
81 elseif (nargin == 3 || chararg == 4)
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
82 x = varargin{1};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
83 y = varargin{2};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
84 img = varargin{3};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
85 climits = [];
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
86 elseif (nargin == 4 || chararg == 5)
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
87 x = varargin{1};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
88 y = varargin{2};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
89 img = varargin{3};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
90 climits = varargin{4};
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
91 endif
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
92
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
93 oldfig = [];
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
94 if (! isempty (hax))
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
95 oldfig = get (0, "currentfigure");
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
96 endif
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
97 unwind_protect
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
98 if (do_new)
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
99 hax = newplot (hax);
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
100 elseif (isempty (hax))
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
101 hax = gca ();
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
102 endif
17692
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
103
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
104 if (do_new)
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
105 htmp = image (x, y, img, "cdatamapping", "scaled", varargin{chararg:end});
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
106 else
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
107 htmp = image ("cdatamapping", "scaled", varargin{:});
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
108 endif
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
109
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
110 if (do_new && ! ishold (hax))
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
111 ## use given climits or guess them from the matrix
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
112 if (numel (climits) == 2 && climits(1) <= climits(2))
24056
ae35d50d9756 Ensure numeric values are passed for the axes "clim" property (bug #52053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23219
diff changeset
113 set (hax, "clim", double (climits));
17692
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
114 elseif (! isempty (climits))
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
115 error ("imagesc: CLIMITS must be in form [lo, hi]");
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
116 endif
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
117 endif
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
118 unwind_protect_cleanup
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
119 if (! isempty (oldfig))
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
120 set (0, "currentfigure", oldfig);
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
121 endif
38cf56b77274 Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents: 17689
diff changeset
122 end_unwind_protect
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
123
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
124 if (nargout > 0)
15683
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
125 h = htmp;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
126 endif
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
127
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
128 endfunction
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
129
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
130
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
131 %!demo
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
132 %! clf;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
133 %! colormap ("default");
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
134 %! img = 1 ./ hilb (11);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
135 %! x = y = -5:5;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
136 %! subplot (2,2,1);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
137 %! h = imagesc (x, y, img);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
138 %! ylabel ("limits = [-5.5, 5.5]");
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
139 %! title ("imagesc (x, y, img)");
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
140 %! subplot (2,2,2);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
141 %! h = imagesc (-x, y, img);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
142 %! title ("imagesc (-x, y, img)");
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
143 %! subplot (2,2,3);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
144 %! h = imagesc (x, -y, img);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
145 %! title ("imagesc (x, -y, img)");
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
146 %! ylabel ("limits = [-5.5, 5.5]");
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
147 %! subplot (2,2,4);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
148 %! h = imagesc (-x, -y, img);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
149 %! title ("imagesc (-x, -y, img)");
559
4e826edfbc56 [project @ 1994-07-25 22:18:28 by jwe]
jwe
parents:
diff changeset
150
15683
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
151 %!demo
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
152 %! clf;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
153 %! colormap ("default");
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
154 %! g = 0.1:0.1:10;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
155 %! h = g'*g;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
156 %! imagesc (g, g, sin (h));
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
157 %! hold on;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
158 %! imagesc (g, g+12, cos (h/2));
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
159 %! axis ([0 10 0 22]);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
160 %! hold off;
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22069
diff changeset
161 %! title ("two consecutive images w/hold()");
6368
ec2a523713b5 [project @ 2007-02-28 22:07:24 by jwe]
jwe
parents: 6046
diff changeset
162
15683
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
163 %!demo
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
164 %! clf;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
165 %! colormap ("default");
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
166 %! g = 0.1:0.1:10;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
167 %! h = g'*g;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
168 %! imagesc (g, g, sin (h));
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
169 %! hold on;
15683
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
170 %! plot (g, 11.0 * ones (size (g)));
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
171 %! imagesc (g, g+12, cos (h/2));
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
172 %! axis ([0 10 0 22]);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
173 %! hold off;
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22069
diff changeset
174 %! title ("image, line, image w/hold()");
559
4e826edfbc56 [project @ 1994-07-25 22:18:28 by jwe]
jwe
parents:
diff changeset
175
15683
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
176 %!demo
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
177 %! clf;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
178 %! colormap ("default");
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
179 %! g = 0.1:0.1:10;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
180 %! h = g'*g;
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
181 %! plot (g, 10.5 * ones (size (g)));
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
182 %! hold on;
15683
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
183 %! imagesc (g, g, sin (h));
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
184 %! plot (g, 11.0 * ones (size (g)));
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
185 %! imagesc (g, g+12, cos (h/2));
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
186 %! plot (g, 11.5 * ones (size (g)));
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
187 %! axis ([0 10 0 22]);
806ea52af230 Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents: 14359
diff changeset
188 %! hold off;
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22069
diff changeset
189 %! title ("line, image, line, image, line w/hold()");
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
190
22369
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22323
diff changeset
191 %!demo # bug #48879
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22323
diff changeset
192 %! clf;
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22323
diff changeset
193 %! img = reshape (1:100, 10, 10);
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22323
diff changeset
194 %! imagesc (img);
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22323
diff changeset
195 %! colormap (prism (10));
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22323
diff changeset
196 %! title ("10 vertical color bars");