annotate scripts/plot/util/isaxes.m @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
1 ## Copyright (C) 2013-2020 The Octave Project Developers
27918
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 ##
17123
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
6 ##
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
7 ## This file is part of Octave.
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
8 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24479
diff changeset
9 ## Octave is free software: you can redistribute it and/or modify it
17123
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
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: 24479
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: 22323
diff changeset
12 ## (at your option) any later version.
17123
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
13 ##
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
14 ## Octave is distributed in the hope that it will be useful, but
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## GNU General Public License for more details.
17123
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
18 ##
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
19 ## You should have received a copy of the GNU General Public License
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
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: 24479
diff changeset
21 ## <https://www.gnu.org/licenses/>.
17123
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
22
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
23 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
24 ## @deftypefn {} {} isaxes (@var{h})
17123
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
25 ## Return true if @var{h} is an axes graphics handle and false otherwise.
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
26 ##
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
27 ## If @var{h} is a matrix then return a logical array which is true where the
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
28 ## elements of @var{h} are axes graphics handles and false where they are not.
24479
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
29 ## @seealso{isfigure, ishghandle, isgraphics}
17123
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
30 ## @end deftypefn
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
31
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
32 function retval = isaxes (h)
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
33
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
34 if (nargin != 1)
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
35 print_usage ();
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
36 endif
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
37
24479
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
38 retval = ishghandle (h);
18754
4ca40b289b2c isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents: 17572
diff changeset
39
24479
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
40 if (any (retval))
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
41 retval(retval) = strcmp (get (h(retval), "type"), "axes");
17123
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
42 endif
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
43
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
44 endfunction
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
45
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
46
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
47 %!test
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
48 %! hf = figure ("visible", "off");
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
49 %! unwind_protect
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
50 %! hax = axes ();
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
51 %! assert (isaxes (hax));
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
52 %! assert (! isaxes (-hax));
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
53 %! unwind_protect_cleanup
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
54 %! close (hf);
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
55 %! end_unwind_protect
bcada0a4f8a7 isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff changeset
56
18754
4ca40b289b2c isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents: 17572
diff changeset
57 %!test
4ca40b289b2c isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents: 17572
diff changeset
58 %! hf = figure ("visible", "off");
4ca40b289b2c isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents: 17572
diff changeset
59 %! unwind_protect
4ca40b289b2c isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents: 17572
diff changeset
60 %! hax = axes ();
4ca40b289b2c isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents: 17572
diff changeset
61 %! assert (isaxes ([hax NaN]), [true false]);
4ca40b289b2c isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents: 17572
diff changeset
62 %! unwind_protect_cleanup
4ca40b289b2c isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents: 17572
diff changeset
63 %! close (hf);
4ca40b289b2c isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents: 17572
diff changeset
64 %! end_unwind_protect
24479
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
65
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
66 %!error isaxes ()
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
67 %!error isaxes (1, 2)