Mercurial > octave
annotate scripts/plot/util/axes.m @ 31212:55415fa6a20f
svgconvert: Use Lossless encoding of images when available (bug #52193)
* acinclude.m4: Check that QPainter::LosslessImageRendering flag is available.
* octave-svgconvert.cc (draw): Use new flag if available.
* print.m (doc): Update word of caution about svgconvert and images.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Mon, 29 Aug 2022 16:36:34 +0200 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
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 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3 ## Copyright (C) 2005-2022 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/>. |
6257 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24499
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
6257 | 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:
24499
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. |
6257 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
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. |
6257 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 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:
24499
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 ######################################################################## |
6257 | 25 |
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 {} {} axes () |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
28 ## @deftypefnx {} {} axes (@var{property}, @var{value}, @dots{}) |
26086
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
29 ## @deftypefnx {} {} axes (@var{hpar}, @var{property}, @var{value}, @dots{}) |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
30 ## @deftypefnx {} {} axes (@var{hax}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
31 ## @deftypefnx {} {@var{h} =} axes (@dots{}) |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
32 ## Create a Cartesian axes object and return a handle to it, or set the current |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
33 ## axes to @var{hax}. |
17042
62d5f73e840c
axes.m: reorder figure children after setting the currentaxes (bug #39539).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
34 ## |
62d5f73e840c
axes.m: reorder figure children after setting the currentaxes (bug #39539).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
35 ## Called without any arguments, or with @var{property}/@var{value} pairs, |
26086
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
36 ## construct a new axes. The optional argument @var{hpar} is a graphics handle |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
37 ## specifying the parent for the new axes and may be a figure, uipanel, or |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
38 ## uitab. |
17042
62d5f73e840c
axes.m: reorder figure children after setting the currentaxes (bug #39539).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
39 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17042
diff
changeset
|
40 ## Called with a single axes handle argument @var{hax}, the function makes |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
41 ## @var{hax} the current axes (as returned by @code{gca}). It also makes |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
42 ## the figure which contains @var{hax} the current figure (as returned by |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
43 ## @code{gcf}). Finally, it restacks the parent object's @code{children} |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
44 ## property so that the axes @var{hax} appears before all other axes handles |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
45 ## in the list. This causes @var{hax} to be displayed on top of any other axes |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
46 ## objects (Z-order stacking). In addition it restacks any legend or colorbar |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
47 ## objects associated with @var{hax} so that they are also visible. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
48 ## |
24551
a7b6502b5cb5
doc: Add @ref from graphic object creation functions to list of graphic properties (bug #52816).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
49 ## Programming Note: The full list of properties is documented at |
28093
05c1217d0dae
doc: Create better looking cross references in Info format (bug #57845).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
50 ## @ref{Axes Properties}. |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19820
diff
changeset
|
51 ## @seealso{gca, set, get} |
6257 | 52 ## @end deftypefn |
53 | |
54 function h = axes (varargin) | |
55 | |
26086
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
56 htmp = hpar = []; |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
57 if (nargin > 0) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
58 if (ishghandle (varargin{1}(1))) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
59 htmp = varargin{1}; |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
60 if (! isscalar (htmp)) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
61 error ("axes: H must be a scalar handle"); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
62 endif |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
63 typ = get (htmp, "type"); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
64 if (strcmp (typ, "axes") && nargin == 1) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
65 cf = ancestor (htmp, "figure"); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
66 if (__is_handle_visible__ (htmp)) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
67 set (0, "currentfigure", cf); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
68 set (cf, "currentaxes", htmp); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
69 endif |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
70 restack_axes (htmp, get (htmp, "parent")); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
71 |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
72 if (nargout > 0) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
73 h = htmp; |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
74 endif |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
75 return; |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
76 |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
77 elseif (any (strcmp (typ, {"figure", "uipanel", "uitab"}))) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
78 hpar = htmp; |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
79 htmp = []; |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
80 varargin(1) = []; |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
81 |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
82 else |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
83 error ("axes: H must be a handle to an axes or container"); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
84 endif |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
85 endif |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
86 endif |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
87 |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
88 if (isempty (hpar)) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
89 ## Find a parent if not given as first argument. |
6851 | 90 idx = find (strcmpi (varargin(1:2:end), "parent"), 1, "first"); |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
91 if (! isempty (idx) && numel (varargin) >= 2*idx) |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
92 hpar = varargin{2*idx}; |
6851 | 93 varargin([2*idx-1, 2*idx]) = []; |
94 else | |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
95 hpar = gcf (); |
6851 | 96 endif |
26086
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
97 endif |
19820
4569903d6c5a
axes.m: reworks axes restacking for ML compatibility (bug #43282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19741
diff
changeset
|
98 |
26086
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
99 ## If there is an annotation axes currently on top of the children stack, |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
100 ## then it must be placed back on top. |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
101 ## FIXME: It may be necessary to keep uiXXX objects above all axes objects |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
102 ## including even the transparent scribe axes layer. |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
103 ch = allchild (hpar); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
104 h_annotation = ch(strcmp (get (ch, "tag"), "scribeoverlay")); |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19820
diff
changeset
|
105 |
26086
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
106 ## Create an axes object. |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
107 htmp = __go_axes__ (hpar, varargin{:}); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
108 if (__is_handle_visible__ (htmp)) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
109 set (ancestor (hpar, "figure"), "currentaxes", htmp); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
110 endif |
19820
4569903d6c5a
axes.m: reworks axes restacking for ML compatibility (bug #43282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19741
diff
changeset
|
111 |
26086
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
112 ## Restack annotation object if necessary |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
113 if (! isempty (h_annotation)) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
114 ## FIXME: This will put annotation layer first, above even uicontrol |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
115 ## objects. May need to keep annotation layer above all axes only. |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
116 shh = get (0, "ShowHiddenHandles"); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
117 unwind_protect |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
118 set (0, "ShowHiddenHandles", "on"); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
119 ch(ch == h_annotation) = htmp; |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
120 ch = [h_annotation; ch]; |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
121 set (hpar, "children", ch); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
122 unwind_protect_cleanup |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
123 set (0, "ShowHiddenHandles", shh); |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
124 end_unwind_protect |
6257 | 125 endif |
126 | |
127 if (nargout > 0) | |
17042
62d5f73e840c
axes.m: reorder figure children after setting the currentaxes (bug #39539).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
128 h = htmp; |
6257 | 129 endif |
130 | |
131 endfunction | |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17125
diff
changeset
|
132 |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
133 function restack_axes (h, hpar) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
134 |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
135 shh = get (0, "ShowHiddenHandles"); |
19820
4569903d6c5a
axes.m: reworks axes restacking for ML compatibility (bug #43282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19741
diff
changeset
|
136 unwind_protect |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
137 set (0, "ShowHiddenHandles", "on"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
138 ch = get (hpar, "children"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
139 axidx = strcmp (get (ch, "type"), "axes"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
140 ## Strip out any annotation axes layer, unless h itself is annotation axes. |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
141 if (! strcmp (get (h, "tag"), "scribeoverlay")) |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
142 axidx(axidx) = ! strcmp (get (ch(axidx), "tag"), "scribeoverlay"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
143 endif |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
144 hax = ch(axidx); # List of axes |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
145 |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
146 ## Find and stack any legend belonging to this axes above this axes. |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
147 try |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
148 hleg = get (h, "__legend_handle__"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
149 catch |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
150 hleg = false; |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
151 end_try_catch |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
152 |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
153 ## Find and stack any colorbar belonging to this axes above this axes. |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
154 try |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
155 hcb = get (h, "__colorbar_handle__"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
156 catch |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
157 hcb = false; |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
158 end_try_catch |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
159 |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
160 ## Preserve order of colorbars and legends above this axes |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
161 if (hleg || hcb) |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
162 if (hleg && ! hcb) |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
163 h = [hleg; h]; |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
164 elseif (hcb && ! hleg) |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
165 h = [hcb; h]; |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
166 else |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
167 hcb_idx = find (hcb == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
168 hleg_idx = find (hleg == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
169 if (hleg_idx < hcb_idx) |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
170 h = [hleg; hcb; h]; |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
171 else |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
172 h = [hcb; hleg; h]; |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
173 endif |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
174 endif |
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
175 endif |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
176 |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
177 ## FIXME: ismember call is very slow (2/3rds of runtime for function) |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
178 ch(axidx) = [h; hax(! ismember (hax, h))]; |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
179 set (hpar, "children", ch); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
180 |
19820
4569903d6c5a
axes.m: reworks axes restacking for ML compatibility (bug #43282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19741
diff
changeset
|
181 unwind_protect_cleanup |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
182 set (0, "ShowHiddenHandles", shh); |
19820
4569903d6c5a
axes.m: reworks axes restacking for ML compatibility (bug #43282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19741
diff
changeset
|
183 end_unwind_protect |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
184 |
19820
4569903d6c5a
axes.m: reworks axes restacking for ML compatibility (bug #43282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19741
diff
changeset
|
185 endfunction |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
186 |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
187 |
24388 | 188 ## FIXME: These demos actually just show how axes objects behave. |
189 ## They do not show how the axes() function itself works. | |
190 %!demo | |
191 %! clf; | |
192 %! x = -10:10; | |
193 %! plot (x,x, x,-x); | |
194 %! set (gca, "yscale", "log"); | |
195 %! legend ({"x >= 1", "x <= 1"}, "location", "north"); | |
196 %! title ({"log axes discard negative data", "ylim = [1, 10]"}); | |
197 | |
198 %!demo | |
199 %! clf; | |
200 %! x = -10:0.1:10; | |
201 %! y = sin (x)./(1 + abs (x)) + 0.1*x - 0.4; | |
202 %! plot (x, y); | |
203 %! set (gca, "xaxislocation", "origin"); | |
204 %! set (gca, "yaxislocation", "origin"); | |
205 %! box off; | |
206 %! title ({"no plot box", "xaxislocation = origin, yaxislocation = origin"}); | |
207 | |
208 %!demo | |
209 %! clf; | |
210 %! x = -10:0.1:10; | |
211 %! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4; | |
212 %! plot (x, y); | |
213 %! set (gca, "xaxislocation", "origin"); | |
214 %! set (gca, "yaxislocation", "left"); | |
215 %! box off; | |
216 %! title ({"no plot box", "xaxislocation = origin, yaxislocation = left"}); | |
217 | |
218 %!demo | |
219 %! clf; | |
220 %! x = -10:0.1:10; | |
221 %! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4; | |
222 %! plot (x, y); | |
223 %! title ("no plot box"); | |
224 %! set (gca, "xaxislocation", "origin"); | |
225 %! set (gca, "yaxislocation", "right"); | |
226 %! box off; | |
227 %! title ({"no plot box", "xaxislocation = origin, yaxislocation = right"}); | |
228 | |
229 %!demo | |
230 %! clf; | |
231 %! x = -10:0.1:10; | |
232 %! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4; | |
233 %! plot (x, y); | |
234 %! set (gca, "xaxislocation", "bottom"); | |
235 %! set (gca, "yaxislocation", "origin"); | |
236 %! box off; | |
237 %! title ({"no plot box", "xaxislocation = bottom, yaxislocation = origin"}); | |
238 | |
239 %!demo | |
240 %! clf; | |
241 %! x = -10:0.1:10; | |
242 %! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4; | |
243 %! plot (x, y); | |
244 %! set (gca, "xaxislocation", "top"); | |
245 %! set (gca, "yaxislocation", "origin"); | |
246 %! box off; | |
247 %! title ({"no plot box", "xaxislocation = top, yaxislocation = origin"}); | |
248 | |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
249 %!test |
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
250 %! hf = figure ("visible", "off"); |
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
251 %! unwind_protect |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
252 %! hax1 = axes ("tag", "axes1"); |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
253 %! plot (1:10, "b"); |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
254 %! hleg1 = legend ("leg1", "location", "east"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
255 %! hcb1 = colorbar ("location", "east"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
256 %! hanno = annotation ("arrow"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
257 %! hscribe = get (hanno, "parent"); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
258 %! |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
259 %! hax2 = axes ("tag", "axes2"); |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
260 %! plot (10:-1:1, "r"); |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
261 %! hcb2 = colorbar ("location", "east"); |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
262 %! hleg2 = legend ("hax2"); |
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
263 %! |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
264 %! ## Verify base configuration |
21937
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21854
diff
changeset
|
265 %! ch = allchild (hf); |
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21854
diff
changeset
|
266 %! hax = ch(isaxes (ch)); |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
267 %! hax1pos = find (hax1 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
268 %! hax2pos = find (hax2 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
269 %! hleg1pos = find (hleg1 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
270 %! hleg2pos = find (hleg2 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
271 %! hcb1pos = find (hcb1 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
272 %! hcb2pos = find (hcb2 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
273 %! hscribepos = find (hscribe == hax); |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
274 %! |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
275 %! assert (all (hscribepos < ... |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
276 %! [hax1pos, hax2pos, hleg1pos, hleg2pos, hcb1pos, hcb2pos])); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
277 %! assert (hax2pos < hax1pos); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
278 %! assert (hleg2pos < hcb2pos && hcb2pos < hax2pos); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
279 %! assert (hcb1pos < hleg1pos && hleg1pos < hax1pos); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
280 %! |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
281 %! ## Restack axes1 on top |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
282 %! axes (hax1); |
21937
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21854
diff
changeset
|
283 %! ch = allchild (hf); |
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21854
diff
changeset
|
284 %! hax = ch(isaxes (ch)); |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
285 %! hax1pos = find (hax1 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
286 %! hax2pos = find (hax2 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
287 %! hleg1pos = find (hleg1 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
288 %! hleg2pos = find (hleg2 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
289 %! hcb1pos = find (hcb1 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
290 %! hcb2pos = find (hcb2 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
291 %! hscribepos = find (hscribe == hax); |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
292 %! |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
293 %! assert (all (hscribepos < ... |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
294 %! [hax1pos, hax2pos, hleg1pos, hleg2pos, hcb1pos, hcb2pos])); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
295 %! assert (hax1pos < hax2pos); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
296 %! assert (hcb1pos < hleg1pos && hleg1pos < hax1pos); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
297 %! assert (hleg2pos < hcb2pos && hcb2pos < hax2pos); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
298 %! |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
299 %! ## Restack axes2 on top |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
300 %! axes (hax2); |
21937
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21854
diff
changeset
|
301 %! ch = allchild (hf); |
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21854
diff
changeset
|
302 %! hax = ch(isaxes (ch)); |
24499
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
303 %! hax1pos = find (hax1 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
304 %! hax2pos = find (hax2 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
305 %! hleg1pos = find (hleg1 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
306 %! hleg2pos = find (hleg2 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
307 %! hcb1pos = find (hcb1 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
308 %! hcb2pos = find (hcb2 == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
309 %! hscribepos = find (hscribe == hax); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
310 %! |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
311 %! assert (all (hscribepos < ... |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
312 %! [hax1pos, hax2pos, hleg1pos, hleg2pos, hcb1pos, hcb2pos])); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
313 %! assert (hax2pos < hax1pos); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
314 %! assert (hleg2pos < hcb2pos && hcb2pos < hax2pos); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
315 %! assert (hcb1pos < hleg1pos && hleg1pos < hax1pos); |
941ea3da921f
axes.m: Fix stacking of axes when legends, colorbars, annotations are present (bug #44410).
Rik <rik@octave.org>
parents:
24498
diff
changeset
|
316 %! |
21854
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
317 %! unwind_protect_cleanup |
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
318 %! close (hf); |
ce0f87bd0509
axes.m: Restack legend along with the specified axes on top of Z-stack (bug #48141).
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
319 %! end_unwind_protect |
26086
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
320 |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
321 %!error <H must be a scalar handle> axes ([0, 0]) |
9a58d7e0554e
axes.m: Allow a parent handle as first argument (bug #53955).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
322 %!error <H must be a handle to an axes or container> axes (0) |