Mercurial > octave
annotate scripts/image/image.m @ 20158:7503499a252b stable
doc: Update docstrings to have one sentence summary as first line.
Update scripts in audio, elfun, general, geometry, and image directories.
* scripts/audio/@audioplayer/__get_properties__.m,
scripts/audio/@audioplayer/audioplayer.m, scripts/audio/@audioplayer/get.m,
scripts/audio/@audioplayer/isplaying.m, scripts/audio/@audioplayer/play.m,
scripts/audio/@audioplayer/playblocking.m, scripts/audio/@audioplayer/set.m,
scripts/audio/@audioplayer/subsasgn.m, scripts/audio/@audioplayer/subsref.m,
scripts/audio/@audiorecorder/audiorecorder.m,
scripts/audio/@audiorecorder/get.m,
scripts/audio/@audiorecorder/getaudiodata.m,
scripts/audio/@audiorecorder/getplayer.m,
scripts/audio/@audiorecorder/isrecording.m,
scripts/audio/@audiorecorder/play.m, scripts/audio/@audiorecorder/record.m,
scripts/audio/@audiorecorder/recordblocking.m,
scripts/audio/@audiorecorder/set.m, scripts/audio/@audiorecorder/stop.m,
scripts/audio/@audiorecorder/subsasgn.m,
scripts/audio/@audiorecorder/subsref.m, scripts/audio/lin2mu.m,
scripts/audio/mu2lin.m, scripts/audio/record.m, scripts/audio/sound.m,
scripts/audio/soundsc.m, scripts/audio/wavread.m, scripts/audio/wavwrite.m,
scripts/elfun/cosd.m, scripts/elfun/sind.m, scripts/elfun/tand.m,
scripts/general/accumarray.m, scripts/general/accumdim.m,
scripts/general/bitcmp.m, scripts/general/bitget.m, scripts/general/bitset.m,
scripts/general/blkdiag.m, scripts/general/cart2pol.m,
scripts/general/cart2sph.m, scripts/general/cell2mat.m,
scripts/general/celldisp.m, scripts/general/chop.m,
scripts/general/circshift.m, scripts/general/common_size.m,
scripts/general/cplxpair.m, scripts/general/cumtrapz.m,
scripts/general/dblquad.m, scripts/general/deal.m, scripts/general/del2.m,
scripts/general/display.m, scripts/general/divergence.m,
scripts/general/fieldnames.m, scripts/general/flip.m,
scripts/general/flipdim.m, scripts/general/fliplr.m, scripts/general/flipud.m,
scripts/general/gradient.m, scripts/general/interp3.m,
scripts/general/interpft.m, scripts/general/interpn.m,
scripts/general/loadobj.m, scripts/general/logspace.m,
scripts/general/methods.m, scripts/general/nargchk.m,
scripts/general/narginchk.m, scripts/general/nargoutchk.m,
scripts/general/nextpow2.m, scripts/general/nthargout.m,
scripts/general/num2str.m, scripts/general/pol2cart.m,
scripts/general/polyarea.m, scripts/general/postpad.m,
scripts/general/prepad.m, scripts/general/profile.m, scripts/general/quadgk.m,
scripts/general/quadl.m, scripts/general/quadv.m, scripts/general/randi.m,
scripts/general/rat.m, scripts/general/repmat.m, scripts/general/rot90.m,
scripts/general/rotdim.m, scripts/general/saveobj.m, scripts/general/shift.m,
scripts/general/shiftdim.m, scripts/general/sortrows.m,
scripts/general/sph2cart.m, scripts/general/structfun.m,
scripts/general/subsindex.m, scripts/general/trapz.m,
scripts/general/triplequad.m, scripts/geometry/delaunayn.m,
scripts/geometry/dsearch.m, scripts/geometry/dsearchn.m,
scripts/geometry/griddata.m, scripts/geometry/griddata3.m,
scripts/geometry/griddatan.m, scripts/geometry/inpolygon.m,
scripts/geometry/rectint.m, scripts/geometry/tsearchn.m,
scripts/geometry/voronoi.m, scripts/geometry/voronoin.m,
scripts/help/__unimplemented__.m, scripts/help/doc.m,
scripts/help/doc_cache_create.m, scripts/help/get_first_help_sentence.m,
scripts/help/help.m, scripts/help/lookfor.m, scripts/help/print_usage.m,
scripts/help/type.m, scripts/help/which.m, scripts/image/autumn.m,
scripts/image/bone.m, scripts/image/brighten.m, scripts/image/cmpermute.m,
scripts/image/colorcube.m, scripts/image/contrast.m, scripts/image/cool.m,
scripts/image/copper.m, scripts/image/cubehelix.m, scripts/image/flag.m,
scripts/image/gmap40.m, scripts/image/gray.m, scripts/image/gray2ind.m,
scripts/image/hot.m, scripts/image/hsv.m, scripts/image/image.m,
scripts/image/imagesc.m, scripts/image/imfinfo.m, scripts/image/imformats.m,
scripts/image/imread.m, scripts/image/imshow.m, scripts/image/imwrite.m,
scripts/image/iscolormap.m, scripts/image/jet.m, scripts/image/lines.m,
scripts/image/ntsc2rgb.m, scripts/image/ocean.m, scripts/image/pink.m,
scripts/image/prism.m, scripts/image/rainbow.m, scripts/image/rgb2ntsc.m,
scripts/image/spinmap.m, scripts/image/spring.m, scripts/image/summer.m,
scripts/image/white.m, scripts/image/winter.m:
Update docstrings to have one sentence summary as first line.
Re-structure to have line lengths <= 80 chars.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 03 May 2015 09:36:20 -0700 |
parents | 2e7497ff2535 |
children | 516bb87ea72e |
rev | line source |
---|---|
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19597
diff
changeset
|
1 ## Copyright (C) 1994-2015 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 -*- |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10704
diff
changeset
|
20 ## @deftypefn {Function File} {} image (@var{img}) |
6257 | 21 ## @deftypefnx {Function File} {} image (@var{x}, @var{y}, @var{img}) |
17689
dd8db3f1c1da
doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents:
17648
diff
changeset
|
22 ## @deftypefnx {Function File} {} image (@dots{}, "@var{prop}", @var{val}, @dots{}) |
dd8db3f1c1da
doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents:
17648
diff
changeset
|
23 ## @deftypefnx {Function File} {} image ("@var{prop1}", @var{val1}, @dots{}) |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13993
diff
changeset
|
24 ## @deftypefnx {Function File} {@var{h} =} image (@dots{}) |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
25 ## Display a matrix as an indexed color image. |
3651 | 26 ## |
14260
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
27 ## The elements of @var{img} are indices into the current colormap. |
20158
7503499a252b
doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19962
diff
changeset
|
28 ## |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
29 ## @var{x} and @var{y} are optional 2-element vectors, @w{@code{[min, max]}}, |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
30 ## which specify the range for the axis labels. If a range is specified as |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
31 ## @w{@code{[max, min]}} then the image will be reversed along that axis. For |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
32 ## convenience, @var{x} and @var{y} may be specified as N-element vectors |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
33 ## matching the length of the data in @var{img}. However, only the first and |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
34 ## last elements will be used to determine the axis limits. |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
35 ## @strong{Warning:} @var{x} and @var{y} are ignored when using gnuplot 4.0 |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
36 ## or earlier. |
10817
d9147775da54
image.m: Always reverse 'ydir' property when displaying images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
37 ## |
17689
dd8db3f1c1da
doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents:
17648
diff
changeset
|
38 ## Multiple property/value pairs may be specified for the image object, but |
dd8db3f1c1da
doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents:
17648
diff
changeset
|
39 ## they must appear in pairs. |
dd8db3f1c1da
doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents:
17648
diff
changeset
|
40 ## |
14260
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
41 ## The optional return value @var{h} is a graphics handle to the image. |
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
42 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
43 ## Implementation Note: The origin (0, 0) for images is located in the |
10817
d9147775da54
image.m: Always reverse 'ydir' property when displaying images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
44 ## upper left. For ordinary plots, the origin is located in the lower |
d9147775da54
image.m: Always reverse 'ydir' property when displaying images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
45 ## left. Octave handles this inversion by plotting the data normally, |
d9147775da54
image.m: Always reverse 'ydir' property when displaying images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
46 ## and then reversing the direction of the y-axis by setting the |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17038
diff
changeset
|
47 ## @code{ydir} property to @qcode{"reverse"}. This has implications whenever |
10817
d9147775da54
image.m: Always reverse 'ydir' property when displaying images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
48 ## an image and an ordinary plot need to be overlaid. The recommended |
d9147775da54
image.m: Always reverse 'ydir' property when displaying images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
49 ## solution is to display the image and then plot the reversed ydata |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
50 ## using, for example, @code{flipud (ydata)}. |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13993
diff
changeset
|
51 ## |
17689
dd8db3f1c1da
doc: Add information about High-Level/Low-Level calling forms for image, imagesc.
Rik <rik@octave.org>
parents:
17648
diff
changeset
|
52 ## Calling Forms: The @code{image} 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:
17648
diff
changeset
|
53 ## 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:
17648
diff
changeset
|
54 ## 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:
17648
diff
changeset
|
55 ## 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:
17648
diff
changeset
|
56 ## 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:
17648
diff
changeset
|
57 ## and inserts it in the current axes. |
11109
41d18f6342f9
remove image_viewer function
John W. Eaton <jwe@octave.org>
parents:
11090
diff
changeset
|
58 ## @seealso{imshow, imagesc, colormap} |
3373 | 59 ## @end deftypefn |
559 | 60 |
3202 | 61 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
2312 | 62 ## Created: July 1994 |
63 ## Adapted-By: jwe | |
904 | 64 |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
65 function h = image (varargin) |
7189 | 66 |
17038
db90efd8f32b
image.m: Update to use new __plt_get_axis_arg__ without using "axes" and "newplot" function.
Rik <rik@octave.org>
parents:
15764
diff
changeset
|
67 [hax, varargin, nargin] = __plt_get_axis_arg__ ("image", varargin{:}); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18622
diff
changeset
|
68 |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
69 chararg = find (cellfun ("isclass", varargin, "char"), 1, "first"); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18622
diff
changeset
|
70 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
71 do_new = true; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
72 if (nargin == 0) |
19324
68db8396c378
Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
73 img = get (0, "defaultimagecdata"); |
7276 | 74 x = y = []; |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18622
diff
changeset
|
75 elseif (chararg == 1) |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
76 ## Low-Level syntax |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
77 do_new = false; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
78 x = y = img = []; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
79 idx = find (strcmpi (varargin, "cdata"), 1); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
80 if (idx) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
81 img = varargin{idx+1}; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
82 varargin(idx:idx+1) = []; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
83 endif |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
84 idx = find (strcmpi (varargin, "xdata"), 1); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
85 if (idx) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
86 x = varargin{idx+1}; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
87 varargin(idx:idx+1) = []; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
88 endif |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
89 idx = find (strcmpi (varargin, "ydata"), 1); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
90 if (idx) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
91 y = varargin{idx+1}; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
92 varargin(idx:idx+1) = []; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
93 endif |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
94 elseif (nargin == 1 || chararg == 2) |
7276 | 95 img = varargin{1}; |
96 x = y = []; | |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
97 elseif (nargin == 2 || chararg == 3) |
7276 | 98 print_usage (); |
7189 | 99 else |
7276 | 100 x = varargin{1}; |
101 y = varargin{2}; | |
102 img = varargin{3}; | |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
103 chararg = 4; |
15064
489736962e80
image.m: Don't accept complex image data (bug #36866)
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
104 endif |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
105 |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
106 oldfig = []; |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
107 if (! isempty (hax)) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
108 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
|
109 endif |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
110 unwind_protect |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
111 if (do_new) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
112 hax = newplot (hax); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
113 elseif (isempty (hax)) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
114 hax = gca (); |
18821
87c3848cf3c0
Fix bug when hggroup used with primitive graphic object (bug #42532).
Rik <rik@octave.org>
parents:
18683
diff
changeset
|
115 else |
87c3848cf3c0
Fix bug when hggroup used with primitive graphic object (bug #42532).
Rik <rik@octave.org>
parents:
18683
diff
changeset
|
116 hax = hax(1); |
17692
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 |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
119 htmp = __img__ (hax, do_new, x, y, img, varargin{chararg:end}); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
120 |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
121 unwind_protect_cleanup |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
122 if (! isempty (oldfig)) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
123 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
|
124 endif |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
125 end_unwind_protect |
7276 | 126 |
7189 | 127 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:
15202
diff
changeset
|
128 h = htmp; |
7189 | 129 endif |
130 | |
131 endfunction | |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
132 |
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
133 ## Generic image creation. |
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
134 ## |
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
135 ## The axis values corresponding to the matrix elements are specified in |
14260
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
136 ## @var{x} and @var{y}. If you're not using gnuplot 4.2 or later, these |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
137 ## variables are ignored. |
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
138 |
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
139 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
140 ## Created: July 1994 |
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
141 ## Adapted-By: jwe |
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
142 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
143 function h = __img__ (hax, do_new, x, y, img, varargin) |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
144 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
145 if (! isempty (img)) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
146 |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
147 if (isempty (x)) |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
148 xdata = []; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
149 else |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
150 xdata = x([1, end])(:).'; # (:).' is a hack to guarantee row vector |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
151 endif |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
152 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
153 if (isempty (y)) |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
154 ydata = []; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
155 else |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
156 ydata = y([1, end])(:).'; |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
157 endif |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
158 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
159 if (numel (x) > 2 && numel (y) > 2) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
160 ## Test data for non-linear spacing which is unsupported |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
161 tol = .01; # 1% tolerance. FIXME: this value was chosen without thought. |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
162 dx = diff (x); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
163 dxmean = (max (x) - min (x)) / (numel (x) - 1); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
164 dx = abs ((abs (dx) - dxmean) / dxmean); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
165 dy = diff (y); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
166 dymean = (max (y) - min (y)) / (numel (y) - 1); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
167 dy = abs ((abs (dy) - dymean) / dymean); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
168 if (any (dx > tol) || any (dy > tol)) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
169 warning (["image: non-linear X, Y data is ignored. " ... |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
170 "IMG will be shown with linear mapping"]); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
171 endif |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
172 endif |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
173 |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
174 endif # ! isempty (img) |
13980
bd2be36fd949
image.m: Warn if input coordinates are not linearly spaced.
Ben Abbott <bpabbott@mac.com>
parents:
13173
diff
changeset
|
175 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
176 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
|
177 ## Set axis properties for new images |
19962
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
178 ## NOTE: Do this before calling __go_image__ so that image is not drawn |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
179 ## once with default auto-scale axis limits and then a second time |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
180 ## with tight axis limits. |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
181 if (! isempty (img)) |
19962
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
182 if (isempty (get (hax, "children"))) |
18622
3283ce934648
Set only 'axis tight' for image functions and Matlab compatibility (bug #42043, bug #41886)
Rik <rik@octave.org>
parents:
18524
diff
changeset
|
183 axis (hax, "tight"); |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
184 endif |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
185 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
186 if (ndims (img) == 3) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
187 if (isinteger (img)) |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
188 cls = class (img); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
189 mn = intmin (cls); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
190 mx = intmax (cls); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
191 set (hax, "clim", double ([mn, mx])); |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
192 endif |
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
193 endif |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
194 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
195 endif # ! isempty (img) |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
196 |
18662
1fc22871bd8b
image.m: Set axes layer to "top" for compatability with Matlab.
Rik <rik@octave.org>
parents:
18622
diff
changeset
|
197 set (hax, "view", [0, 90], "ydir", "reverse", "layer", "top"); |
10817
d9147775da54
image.m: Always reverse 'ydir' property when displaying images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
198 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
199 endif # do_new |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
200 |
19962
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
201 h = __go_image__ (hax, "cdata", img, "xdata", xdata, "ydata", ydata, |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
202 "cdatamapping", "direct", varargin{:}); |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
203 |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
204 if (do_new && ! ishold (hax) && ! isempty (img) |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
205 && isscalar (get (hax, "children"))) |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
206 ## Re-scale axis limits for an image in a new figure or axis. |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
207 axis (hax, "tight"); |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
208 endif |
2e7497ff2535
image.m: Don't draw new image object twice for performance (bug #44567).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
209 |
9899
9f25290a35e8
more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
210 endfunction |
10942
48a1812fcc3a
image.m: Matlab compatible axis limits, add demo.
Ben Abbott <bpabbott@mac.com>
parents:
10818
diff
changeset
|
211 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
212 |
10942
48a1812fcc3a
image.m: Matlab compatible axis limits, add demo.
Ben Abbott <bpabbott@mac.com>
parents:
10818
diff
changeset
|
213 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
214 %! clf; |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
215 %! colormap (jet (21)); |
11080
36ceff79607b
image.m: Allow x/ydata to imply a flip of the image. Modify demos.
Ben Abbott <bpabbott@mac.com>
parents:
11076
diff
changeset
|
216 %! img = 1 ./ hilb (11); |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
217 %! x = y = -5:5; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
218 %! subplot (2,2,1); |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
219 %! h = image (x, y, img); |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
220 %! 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:
15202
diff
changeset
|
221 %! title ("image (x, y, img)"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
222 %! subplot (2,2,2); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
223 %! h = image (-x, y, img); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
224 %! title ("image (-x, y, img)"); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
225 %! subplot (2,2,3); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
226 %! h = image (x, -y, img); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
227 %! title ("image (x, -y, img)"); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
228 %! ylabel ("limits = [-5.5, 5.5]"); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
229 %! subplot (2,2,4); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
230 %! h = image (-x, -y, img); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
231 %! title ("image (-x, -y, img)"); |
10942
48a1812fcc3a
image.m: Matlab compatible axis limits, add demo.
Ben Abbott <bpabbott@mac.com>
parents:
10818
diff
changeset
|
232 |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
233 %!test |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
234 %! ## test hidden properties x/ydatamode (bug #42121) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
235 %! hf = figure ("visible", "off"); |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
236 %! unwind_protect |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
237 %! nx = 64; ny = 64; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
238 %! cdata = rand (ny, nx)*127; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
239 %! hi = image (cdata); # x/ydatamode is auto |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
240 %! assert (get (hi, "xdata"), [1 nx]) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
241 %! assert (get (hi, "ydata"), [1 ny]) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
242 %! set (hi, "cdata", cdata(1:2:end, 1:2:end)) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
243 %! assert (get (hi, "xdata"), [1 nx/2]) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
244 %! assert (get (hi, "ydata"), [1 ny/2]) |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
245 %! |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
246 %! set (hi, "xdata", [10 100]) # xdatamode is now manual |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
247 %! set (hi, "ydata", [10 1000]) # ydatamode is now manual |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
248 %! set (hi, "cdata", cdata) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
249 %! assert (get (hi, "xdata"), [10 100]) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
250 %! assert (get (hi, "ydata"), [10 1000]) |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
251 %! |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
252 %! set (hi, "ydata", []) # ydatamode is now auto |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
253 %! set (hi, "cdata", cdata(1:2:end, 1:2:end)) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
254 %! assert (get (hi, "xdata"), [10 100]) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
255 %! assert (get (hi, "ydata"), [1 ny/2]) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
256 %! unwind_protect_cleanup |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
257 %! close (hf) |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
258 %! end_unwind_protect |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18821
diff
changeset
|
259 |
17692
38cf56b77274
Overhaul image, imagesc to use newplot and support low-level invocation form.
Rik <rik@octave.org>
parents:
17689
diff
changeset
|
260 ## FIXME: Need %!tests for linear |