Mercurial > hg > octave-lyh
annotate scripts/plot/plotyy.m @ 17405:0bf2fc8562c9
doc: Update documentation for file and directory functions.
* libinterp/corefcn/dirfns.cc(Fpwd, Freaddir, Fmkdir, Frmdir, Freadlink, Ffnmatch): Redo docstring.
* libinterp/corefcn/dirfns.cc(Fcd): Redo docstring. Return previous working
directory if nargout > 0.
* libinterp/corefcn/dirfns.cc(Flink, Fsymlink, Frename): Redo docstring.
Re-order return values so that highest numbered value is assigned first to
avoid re-sizing octave_value_list each time.
* libinterp/corefcn/syscalls.cc(Flstat, Fmkfifo, FS_ISREG, FS_ISDIR, FS_ISCHR,
FS_ISBLK, FS_ISFIFO, FS_ISLNK, FS_ISSOCK): Redo docstring.
* scripts/general/isdir.m: Add more xrefs to @seealso.
* scripts/miscellaneous/copyfile.m: Add more xrefs to @seealso.
* scripts/miscellaneous/dir.m: Redo docstring.
* scripts/miscellaneous/ls.m: Add more xrefs to @seealso.m.
* scripts/miscellaneous/movefile.m: Add more xrefs to @seealso.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 09 Sep 2013 14:30:31 -0700 |
parents | b5d6314314fc |
children |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13216
diff
changeset
|
1 ## Copyright (C) 2007-2012 David Bateman |
7195 | 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 | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
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 | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
20 ## @deftypefn {Function File} {} plotyy (@var{x1}, @var{y1}, @var{x2}, @var{y2}) |
7195 | 21 ## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun}) |
22 ## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun1}, @var{fun2}) | |
17126
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
23 ## @deftypefnx {Function File} {} plotyy (@var{hax}, @dots{}) |
7195 | 24 ## @deftypefnx {Function File} {[@var{ax}, @var{h1}, @var{h2}] =} plotyy (@dots{}) |
17126
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
25 ## Plot two sets of data with independent y-axes. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
26 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
27 ## The arguments @var{x1} and @var{y1} define the arguments for the first plot |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
28 ## and @var{x1} and @var{y2} for the second. |
7195 | 29 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
30 ## By default the arguments are evaluated with |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
31 ## @code{feval (@@plot, @var{x}, @var{y})}. However the type of plot can be |
7195 | 32 ## modified with the @var{fun} argument, in which case the plots are |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
33 ## generated by @code{feval (@var{fun}, @var{x}, @var{y})}. @var{fun} can be |
17126
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
34 ## a function handle, an inline function, or a string of a function name. |
7195 | 35 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
36 ## The function to use for each of the plots can be independently defined |
7195 | 37 ## with @var{fun1} and @var{fun2}. |
38 ## | |
17126
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
39 ## If the first argument @var{hax} is an axes handle, then it defines |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
40 ## the principal axis in which to plot the @var{x1} and @var{y1} data. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
41 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
42 ## The return value @var{ax} is a vector with the axis handles of the two |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
43 ## y axes. @var{h1} and @var{h2} are handles to the objects generated by the |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17068
diff
changeset
|
44 ## plot commands. |
7195 | 45 ## |
46 ## @example | |
47 ## @group | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
48 ## x = 0:0.1:2*pi; |
7195 | 49 ## y1 = sin (x); |
7196 | 50 ## y2 = exp (x - 1); |
51 ## ax = plotyy (x, y1, x - 1, y2, @@plot, @@semilogy); | |
7195 | 52 ## xlabel ("X"); |
53 ## ylabel (ax(1), "Axis 1"); | |
54 ## ylabel (ax(2), "Axis 2"); | |
55 ## @end group | |
56 ## @end example | |
16814
64e7bb01fce2
doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents:
15202
diff
changeset
|
57 ## @seealso{plot} |
7195 | 58 ## @end deftypefn |
59 | |
60 function [Ax, H1, H2] = plotyy (varargin) | |
61 | |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
62 ## Don't use __plt_get_axis_arg__ here as ax is a two vector for plotyy |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
63 if (nargin > 1 && length (varargin{1}) == 2 && ishandle (varargin{1}(1)) |
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
64 && ishandle (varargin{1}(2)) |
11149
fe3c3dfc07eb
style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents:
10950
diff
changeset
|
65 && all (floor (varargin{1}) != varargin{1})) |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
66 obj1 = get (varargin{1}(1)); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
67 obj2 = get (varargin{1}(2)); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
68 if (strcmp (obj1.type, "axes") || strcmp (obj2.type, "axes")) |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
69 ax = [obj1, obj2]; |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
70 varargin(1) = []; |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
71 if (isempty (varargin)) |
10549 | 72 varargin = {}; |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
73 endif |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
74 else |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
75 error ("plotyy: expecting first argument to be axes handle"); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
76 endif |
13033
d0dccc6dd4e7
plotyy.m: Always restore current axes when done.
Ben Abbott <bpabbott@mac.com>
parents:
12575
diff
changeset
|
77 oldh = gca (); |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
78 else |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
79 f = get (0, "currentfigure"); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
80 if (isempty (f)) |
9346
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
81 f = figure (); |
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
82 endif |
9349
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
83 ca = get (f, "currentaxes"); |
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
84 if (isempty (ca)) |
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
85 ax = []; |
13216 | 86 elseif (ishandle (ca) && isprop (ca, "__plotyy_axes__")) |
9349
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
87 ax = get (ca, "__plotyy_axes__"); |
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
88 else |
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
89 ax = ca; |
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
90 endif |
9346
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
91 if (length (ax) > 2) |
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
92 for i = 3 : length (ax) |
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
93 delete (ax (i)); |
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
94 endfor |
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
95 ax = ax(1:2); |
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
96 elseif (length (ax) == 1) |
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
97 ax(2) = axes (); |
15202
f3b5cadfd6d5
fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents:
14868
diff
changeset
|
98 set (ax(2), "nextplot", get (ax(1), "nextplot")); |
9346
d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
99 elseif (isempty (ax)) |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
100 ax(1) = axes (); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
101 ax(2) = axes (); |
13033
d0dccc6dd4e7
plotyy.m: Always restore current axes when done.
Ben Abbott <bpabbott@mac.com>
parents:
12575
diff
changeset
|
102 ca = ax(2); |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
103 endif |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
104 if (nargin < 2) |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
105 varargin = {}; |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
106 endif |
13033
d0dccc6dd4e7
plotyy.m: Always restore current axes when done.
Ben Abbott <bpabbott@mac.com>
parents:
12575
diff
changeset
|
107 oldh = ca; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
108 endif |
7215 | 109 |
110 if (nargin < 4) | |
111 print_usage (); | |
112 endif | |
7216 | 113 |
7215 | 114 unwind_protect |
115 [ax, h1, h2] = __plotyy__ (ax, varargin{:}); | |
116 unwind_protect_cleanup | |
8237
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
117 ## Only change back to the old axis if we didn't delete it |
17129
b5d6314314fc
Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
118 if (isaxes (oldh)) |
8237
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
119 axes (oldh); |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
120 endif |
7215 | 121 end_unwind_protect |
7195 | 122 |
123 if (nargout > 0) | |
124 Ax = ax; | |
125 H1 = h1; | |
126 H2 = h2; | |
127 endif | |
7196 | 128 |
7195 | 129 endfunction |
130 | |
131 function [ax, h1, h2] = __plotyy__ (ax, x1, y1, x2, y2, varargin) | |
132 if (nargin > 5) | |
133 fun1 = varargin{1}; | |
134 else | |
135 fun1 = @plot; | |
136 endif | |
137 if (nargin > 6) | |
138 fun2 = varargin{2}; | |
139 else | |
140 fun2 = fun1; | |
141 endif | |
142 | |
143 xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])]; | |
144 | |
17129
b5d6314314fc
Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
145 if (isaxes (ax(1))) |
8237
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
146 axes (ax(1)); |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
147 else |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
148 ax(1) = axes (); |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
149 endif |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
150 newplot (); |
7195 | 151 h1 = feval (fun1, x1, y1); |
7220 | 152 |
153 set (ax(1), "ycolor", getcolor (h1(1))); | |
7195 | 154 set (ax(1), "xlim", xlim); |
10136
ee18258bc002
Also treat white figure and axes color properties
David Bateman <dbateman@free.fr>
parents:
9353
diff
changeset
|
155 set (ax(1), "color", "none"); |
7195 | 156 |
157 cf = gcf (); | |
158 set (cf, "nextplot", "add"); | |
8237
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
159 |
17129
b5d6314314fc
Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
160 if (isaxes (ax(2))) |
8237
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
161 axes (ax(2)); |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
162 else |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
163 ax(2) = axes (); |
15202
f3b5cadfd6d5
fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents:
14868
diff
changeset
|
164 set (ax(2), "nextplot", get (ax(1), "nextplot")); |
8237
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
165 endif |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
166 newplot (); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
167 |
7195 | 168 colors = get (ax(1), "colororder"); |
169 set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]); | |
170 | |
12685
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
171 if (strcmp (get (ax(1), "autopos_tag"), "subplot")) |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
172 set (ax(2), "autopos_tag", "subplot"); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
173 else |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
174 set (ax, "activepositionproperty", "position"); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
175 endif |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
176 |
17068 | 177 ## Kluge, until __plt_get_axis_arg__ and newplot are reworked. |
178 set (ax(2), "nextplot", "replacechildren"); | |
179 h2 = feval (fun2, ax(2), x2, y2); | |
7206 | 180 set (ax(2), "yaxislocation", "right"); |
7220 | 181 set (ax(2), "ycolor", getcolor (h2(1))); |
12685
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
182 |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
183 if (strcmp (get(ax(1), "activepositionproperty"), "position")) |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
184 set (ax(2), "position", get (ax(1), "position")); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
185 else |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
186 set (ax(2), "outerposition", get (ax(1), "outerposition")); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
187 set (ax(2), "looseinset", get (ax(1), "looseinset")); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
188 endif |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
189 |
7195 | 190 set (ax(2), "xlim", xlim); |
7240 | 191 set (ax(2), "color", "none"); |
12128
e916491cbb99
plotyy.m: Set box property to off to allow both y-axes colors to be visible for OpenGL backends.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
192 set (ax(2), "box", "off"); |
8208 | 193 |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
194 ## Add invisible text objects that when destroyed, |
8208 | 195 ## also remove the other axis |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
196 t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy", |
10549 | 197 "handlevisibility", "off", "visible", "off", |
198 "xliminclude", "off", "yliminclude", "off"); | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
199 t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy", |
10549 | 200 "handlevisibility", "off", "visible", "off", |
201 "xliminclude", "off", "yliminclude", "off"); | |
8208 | 202 |
203 set (t1, "deletefcn", {@deleteplotyy, ax(2), t2}); | |
204 set (t2, "deletefcn", {@deleteplotyy, ax(1), t1}); | |
205 | |
206 addlistener (ax(1), "position", {@update_position, ax(2)}); | |
207 addlistener (ax(2), "position", {@update_position, ax(1)}); | |
12685
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
208 addlistener (ax(1), "outerposition", {@update_position, ax(2)}); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
209 addlistener (ax(2), "outerposition", {@update_position, ax(1)}); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
210 addlistener (ax(1), "looseinset", {@update_position, ax(2)}); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
211 addlistener (ax(2), "looseinset", {@update_position, ax(1)}); |
8208 | 212 addlistener (ax(1), "view", {@update_position, ax(2)}); |
213 addlistener (ax(2), "view", {@update_position, ax(1)}); | |
10226
2884758e265b
Replace dataaspectratio props with plotboxaspectratio props.
Ben Abbott <bpabbott@mac.com>
parents:
10136
diff
changeset
|
214 addlistener (ax(1), "plotboxaspectratio", {@update_position, ax(2)}); |
2884758e265b
Replace dataaspectratio props with plotboxaspectratio props.
Ben Abbott <bpabbott@mac.com>
parents:
10136
diff
changeset
|
215 addlistener (ax(2), "plotboxaspectratio", {@update_position, ax(1)}); |
10529
7147078550fe
plotyy.m: Add listener for dataaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents:
10226
diff
changeset
|
216 addlistener (ax(1), "plotboxaspectratiomode", {@update_position, ax(2)}); |
7147078550fe
plotyy.m: Add listener for dataaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents:
10226
diff
changeset
|
217 addlistener (ax(2), "plotboxaspectratiomode", {@update_position, ax(1)}); |
14780
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
218 addlistener (ax(1), "nextplot", {@update_nextplot, ax(2)}); |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
219 addlistener (ax(2), "nextplot", {@update_nextplot, ax(1)}); |
8208 | 220 |
9349
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
221 ## Store the axes handles for the sister axes. |
13216 | 222 if (ishandle (ax(1)) && ! isprop (ax(1), "__plotyy_axes__")) |
10950
c9786e03670c
Don't create __plotyy_axes__ properties in plotyy if they exist (Bug #30977)
David Bateman <dbateman@free.fr>
parents:
10949
diff
changeset
|
223 addproperty ("__plotyy_axes__", ax(1), "data", ax); |
13216 | 224 elseif (ishandle (ax(1))) |
10950
c9786e03670c
Don't create __plotyy_axes__ properties in plotyy if they exist (Bug #30977)
David Bateman <dbateman@free.fr>
parents:
10949
diff
changeset
|
225 set (ax(1), "__plotyy_axes__", ax); |
13216 | 226 else |
15202
f3b5cadfd6d5
fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents:
14868
diff
changeset
|
227 error ("plotyy.m: This shouldn't happen. File a bug report."); |
13216 | 228 endif |
229 if (ishandle (ax(2)) && ! isprop (ax(2), "__plotyy_axes__")) | |
10950
c9786e03670c
Don't create __plotyy_axes__ properties in plotyy if they exist (Bug #30977)
David Bateman <dbateman@free.fr>
parents:
10949
diff
changeset
|
230 addproperty ("__plotyy_axes__", ax(2), "data", ax); |
13216 | 231 elseif (ishandle (ax(2))) |
10950
c9786e03670c
Don't create __plotyy_axes__ properties in plotyy if they exist (Bug #30977)
David Bateman <dbateman@free.fr>
parents:
10949
diff
changeset
|
232 set (ax(2), "__plotyy_axes__", ax); |
13216 | 233 else |
15202
f3b5cadfd6d5
fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents:
14868
diff
changeset
|
234 error ("plotyy.m: This shouldn't happen. File a bug report."); |
13216 | 235 endif |
8208 | 236 endfunction |
237 | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
238 |
8208 | 239 %!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
|
240 %! clf; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
241 %! x = 0:0.1:2*pi; |
8208 | 242 %! y1 = sin (x); |
243 %! y2 = exp (x - 1); | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
244 %! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
245 %! xlabel ('X'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
246 %! ylabel (ax(1), 'Axis 1'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
247 %! ylabel (ax(2), 'Axis 2'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
248 %! axes (ax(1)); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
249 %! text (0.5, 0.5, 'Left Axis', ... |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
250 %! 'color', [0 0 1], 'horizontalalignment', 'center'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
251 %! axes (ax(2)); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
252 %! text (4.5, 80, 'Right Axis', ... |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
253 %! 'color', [0 0.5 0], 'horizontalalignment', 'center'); |
8208 | 254 |
9349
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
255 %!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
|
256 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
257 %! colormap ('default'); |
9349
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
258 %! x = linspace (-1, 1, 201); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
259 %! subplot (2,2,1); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
260 %! plotyy (x,sin(pi*x), x,10*cos(pi*x)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
261 %! 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
|
262 %! surf (peaks (25)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
263 %! 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
|
264 %! contour (peaks (25)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
265 %! 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
|
266 %! plotyy (x,10*sin(2*pi*x), x,cos(2*pi*x)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
267 %! axis square; |
9349
93664cbb732c
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
9346
diff
changeset
|
268 |
13033
d0dccc6dd4e7
plotyy.m: Always restore current axes when done.
Ben Abbott <bpabbott@mac.com>
parents:
12575
diff
changeset
|
269 %!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
|
270 %! clf; |
13033
d0dccc6dd4e7
plotyy.m: Always restore current axes when done.
Ben Abbott <bpabbott@mac.com>
parents:
12575
diff
changeset
|
271 %! x = linspace (-1, 1, 201); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
272 %! hax = plotyy (x, sin (pi*x), x, cos (pi*x)); |
14780
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
273 %! ylabel (hax(1), 'Blue on the Left'); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
274 %! ylabel (hax(2), 'Green on the Right'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
275 %! xlabel ('xlabel'); |
13033
d0dccc6dd4e7
plotyy.m: Always restore current axes when done.
Ben Abbott <bpabbott@mac.com>
parents:
12575
diff
changeset
|
276 |
14780
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
277 %!demo |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
278 %! clf |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
279 %! hold on |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
280 %! t = (0:0.1:9); |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
281 %! x = sin (t); |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
282 %! y = 5 * cos (t); |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
283 %! [hax, h1, h2] = plotyy (t, x, t, y); |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
284 %! [~, h3, h4] = plotyy (t+1, x, t+1, y); |
16828
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
285 %! set ([h3, h4], 'linestyle', '--'); |
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
286 %! xlabel (hax(1), 'xlabel'); |
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
287 %! title (hax(2), 'title'); |
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
288 %! ylabel (hax(1), 'Left axis is Blue'); |
ddac88d32d6a
Make demos in plot m-files compatible with Matlab for running comparison script.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
289 %! ylabel (hax(2), 'Right axis is Green'); |
14780
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
290 |
8208 | 291 function deleteplotyy (h, d, ax2, t2) |
17129
b5d6314314fc
Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
292 if (isaxes (ax2) |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14780
diff
changeset
|
293 && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")) |
11149
fe3c3dfc07eb
style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents:
10950
diff
changeset
|
294 && strcmp (get (ax2, "beingdeleted"), "off")) |
8208 | 295 set (t2, "deletefcn", []); |
296 delete (ax2); | |
297 endif | |
298 endfunction | |
299 | |
14780
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
300 function update_nextplot (h, d, ax2) |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
301 persistent recursion = false; |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
302 prop = "nextplot"; |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
303 if (! recursion) |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
304 unwind_protect |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
305 recursion = true; |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
306 set (ax2, prop, get (h, prop)); |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
307 unwind_protect_cleanup |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
308 recursion = false; |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
309 end_unwind_protect |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
310 endif |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
311 endfunction |
1d83d1539b2b
Fix plotyy to function as expected with "hold on" (Bug # 36508)
Ben Abbott <bpabbott@mac.com>
parents:
14363
diff
changeset
|
312 |
8208 | 313 function update_position (h, d, ax2) |
314 persistent recursion = false; | |
315 | |
316 ## Don't allow recursion | |
317 if (! recursion) | |
318 unwind_protect | |
319 recursion = true; | |
320 view = get (h, "view"); | |
321 oldview = get (ax2, "view"); | |
12685
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
322 plotboxaspectratio = get (h, "plotboxaspectratio"); |
10226
2884758e265b
Replace dataaspectratio props with plotboxaspectratio props.
Ben Abbott <bpabbott@mac.com>
parents:
10136
diff
changeset
|
323 oldplotboxaspectratio = get (ax2, "plotboxaspectratio"); |
12685
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
324 plotboxaspectratiomode = get (h, "plotboxaspectratiomode"); |
10226
2884758e265b
Replace dataaspectratio props with plotboxaspectratio props.
Ben Abbott <bpabbott@mac.com>
parents:
10136
diff
changeset
|
325 oldplotboxaspectratiomode = get (ax2, "plotboxaspectratiomode"); |
12685
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
326 |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
327 if (strcmp (get(h, "activepositionproperty"), "position")) |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
328 position = get (h, "position"); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
329 oldposition = get (ax2, "position"); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
330 if (! (isequal (position, oldposition) && isequal (view, oldview))) |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
331 set (ax2, "position", position, "view", view); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
332 endif |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
333 else |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
334 outerposition = get (h, "outerposition"); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
335 oldouterposition = get (ax2, "outerposition"); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
336 if (! (isequal (outerposition, oldouterposition) && isequal (view, oldview))) |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
337 set (ax2, "outerposition", outerposition, "view", view); |
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
338 endif |
9353
335dc62068a8
plotyy.m: Consider dataaspectratiomode before changing dataaspectratio.
Ben Abbott <bpabbott@mac.com>
parents:
9349
diff
changeset
|
339 endif |
12685
5cbf660e649d
Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents:
12575
diff
changeset
|
340 |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
341 if (! (isequal (plotboxaspectratio, oldplotboxaspectratio) |
10549 | 342 && isequal (plotboxaspectratiomode, oldplotboxaspectratiomode))) |
343 set (ax2, "plotboxaspectratio", plotboxaspectratio); | |
344 set (ax2, "plotboxaspectratiomode", plotboxaspectratiomode); | |
8208 | 345 endif |
346 unwind_protect_cleanup | |
347 recursion = false; | |
348 end_unwind_protect | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
349 endif |
7195 | 350 endfunction |
7220 | 351 |
352 function color = getcolor (ax) | |
353 obj = get (ax); | |
354 if (isfield (obj, "color")) | |
355 color = obj.color; | |
356 elseif (isfield (obj, "facecolor") && ! ischar (obj.facecolor)) | |
357 color = obj.facecolor; | |
358 elseif (isfield (obj, "edgecolor") && ! ischar (obj.edgecolor)) | |
359 color = obj.edgecolor; | |
360 else | |
361 color = [0, 0, 0]; | |
362 endif | |
363 endfunction | |
7245 | 364 |