Mercurial > octave
annotate scripts/plot/util/isaxes.m @ 29359:7854d5752dd2
maint: merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2021 10:10:40 -0500 |
parents | de5f2f9a64ff 0a5b15007766 |
children | 83aeaba707d8 796f54d4ddbf |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
3 ## Copyright (C) 2013-2021 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
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
17123
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
7 ## |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
8 ## 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
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24479
diff
changeset
|
10 ## 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
|
11 ## 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
|
12 ## 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
|
13 ## (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
|
14 ## |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
15 ## 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
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## 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
|
19 ## |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
20 ## 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
|
21 ## 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
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
17123
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
25 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
27 ## @deftypefn {} {} isaxes (@var{h}) |
17123
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
28 ## 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
|
29 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
30 ## 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
|
31 ## 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
|
32 ## @seealso{isfigure, ishghandle, isgraphics} |
17123
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
33 ## @end deftypefn |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
34 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
35 function retval = isaxes (h) |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
36 |
28891
de5f2f9a64ff
maint: Use same coding style when checking for a minimum of 1 input.
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
37 if (nargin < 1) |
17123
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
38 print_usage (); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
39 endif |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
40 |
24479
6d2dc40a7c00
isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents:
24423
diff
changeset
|
41 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
|
42 |
24479
6d2dc40a7c00
isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents:
24423
diff
changeset
|
43 if (any (retval)) |
6d2dc40a7c00
isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents:
24423
diff
changeset
|
44 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
|
45 endif |
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 endfunction |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
48 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
49 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
50 %!test |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
51 %! hf = figure ("visible", "off"); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
52 %! unwind_protect |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
53 %! hax = axes (); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
54 %! assert (isaxes (hax)); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
55 %! assert (! isaxes (-hax)); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
56 %! unwind_protect_cleanup |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
57 %! close (hf); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
58 %! end_unwind_protect |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
59 |
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
|
60 %!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
|
61 %! 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
|
62 %! 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
|
63 %! 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
|
64 %! 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
|
65 %! 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
|
66 %! 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
|
67 %! 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
|
68 |
28886
d8318c12d903
test: remove unnecessary BIST tests in m-files checking for excessive number of inputs.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
69 %!error <Invalid call> isaxes () |