Mercurial > hg > octave-nkf
annotate scripts/plot/plotyy.m @ 12118:973f585cfdf2 release-3-2-x
include PTHREAD_CFLAGS in LINK_DEPS for liboctave
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 22 Jan 2010 10:21:33 +0100 |
parents | f944142010ce |
children | 335dc62068a8 |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 2007, 2008, 2009 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 -*- | |
20 ## @deftypefn {Function File} {} plotyy (@var{x1}, @var{y1}, @var{x2}, @var{y2}) | |
21 ## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun}) | |
22 ## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun1}, @var{fun2}) | |
23 ## @deftypefnx {Function File} {} plotyy (@var{h}, @dots{}) | |
24 ## @deftypefnx {Function File} {[@var{ax}, @var{h1}, @var{h2}] =} plotyy (@dots{}) | |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
25 ## Plots two sets of data with independent y-axes. The arguments @var{x1} and |
7195 | 26 ## @var{y1} define the arguments for the first plot and @var{x1} and @var{y2} |
27 ## for the second. | |
28 ## | |
29 ## By default the arguments are evaluated with | |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
30 ## @code{feval (@@plot, @var{x}, @var{y})}. However the type of plot can be |
7195 | 31 ## modified with the @var{fun} argument, in which case the plots are |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
32 ## generated by @code{feval (@var{fun}, @var{x}, @var{y})}. @var{fun} can be |
7195 | 33 ## a function handle, an inline function or a string of a function name. |
34 ## | |
35 ## The function to use for each of the plots can be independently defined | |
36 ## with @var{fun1} and @var{fun2}. | |
37 ## | |
38 ## If given, @var{h} defines the principal axis in which to plot the @var{x1} | |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
39 ## and @var{y1} data. The return value @var{ax} is a two element vector with |
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
40 ## the axis handles of the two plots. @var{h1} and @var{h2} are handles to |
7195 | 41 ## the objects generated by the plot commands. |
42 ## | |
43 ## @example | |
44 ## @group | |
45 ## x = 0:0.1:2*pi; | |
46 ## y1 = sin (x); | |
7196 | 47 ## y2 = exp (x - 1); |
48 ## ax = plotyy (x, y1, x - 1, y2, @@plot, @@semilogy); | |
7195 | 49 ## xlabel ("X"); |
50 ## ylabel (ax(1), "Axis 1"); | |
51 ## ylabel (ax(2), "Axis 2"); | |
52 ## @end group | |
53 ## @end example | |
54 ## @end deftypefn | |
55 | |
56 function [Ax, H1, H2] = plotyy (varargin) | |
57 | |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
58 ## Don't use __plt_get_axis_arg__ here as ax is a two vector for plotyy |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
59 if (nargin > 1 && length (varargin{1}) == 2 && ishandle(varargin{1}(1)) |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
60 && ishandle(varargin{1}(2)) && |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
61 all (floor (varargin{1}) != varargin{1})) |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
62 obj1 = get (varargin{1}(1)); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
63 obj2 = get (varargin{1}(2)); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
64 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
|
65 ax = [obj1, obj2]; |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
66 varargin(1) = []; |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
67 if (isempty (varargin)) |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
68 varargin = {}; |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
69 endif |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
70 else |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
71 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
|
72 endif |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
73 else |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
74 f = get (0, "currentfigure"); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
75 if (isempty (f)) |
11993
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
76 f = figure (); |
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
77 endif |
11994
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
78 ca = get (f, "currentaxes"); |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
79 if (isempty (ca)) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
80 ax = []; |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
81 elseif (strcmp (get (ca, "tag"), "plotyy")); |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
82 ax = get (ca, "__plotyy_axes__"); |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
83 else |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
84 ax = ca; |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
85 endif |
11993
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
86 if (length (ax) > 2) |
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
87 for i = 3 : length (ax) |
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
88 delete (ax (i)); |
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
89 endfor |
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
90 ax = ax(1:2); |
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
91 elseif (length (ax) == 1) |
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
92 ax(2) = axes (); |
9caef5712f40
plotyy.m: Correct behavior when there is no currentfigure.
Ben Abbott <bpabbott@mac.com>
parents:
9040
diff
changeset
|
93 elseif (isempty (ax)) |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
94 ax(1) = axes (); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
95 ax(2) = axes (); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
96 endif |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
97 if (nargin < 2) |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
98 varargin = {}; |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
99 endif |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
100 endif |
7215 | 101 |
102 if (nargin < 4) | |
103 print_usage (); | |
104 endif | |
7216 | 105 |
7215 | 106 oldh = gca (); |
107 unwind_protect | |
108 [ax, h1, h2] = __plotyy__ (ax, varargin{:}); | |
109 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
|
110 ## Only change back to the old axis if we didn't delete it |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
111 if (ishandle(oldh) && strcmp (get (oldh, "type"), "axes")) |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
112 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
|
113 endif |
7215 | 114 end_unwind_protect |
7195 | 115 |
116 if (nargout > 0) | |
117 Ax = ax; | |
118 H1 = h1; | |
119 H2 = h2; | |
120 endif | |
7196 | 121 |
7195 | 122 endfunction |
123 | |
124 function [ax, h1, h2] = __plotyy__ (ax, x1, y1, x2, y2, varargin) | |
125 if (nargin > 5) | |
126 fun1 = varargin{1}; | |
127 else | |
128 fun1 = @plot; | |
129 endif | |
130 if (nargin > 6) | |
131 fun2 = varargin{2}; | |
132 else | |
133 fun2 = fun1; | |
134 endif | |
135 | |
136 xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])]; | |
137 | |
8237
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
138 if (ishandle(ax(1)) && strcmp (get (ax(1), "type"), "axes")) |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
139 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
|
140 else |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
141 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
|
142 endif |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
143 newplot (); |
7195 | 144 h1 = feval (fun1, x1, y1); |
7220 | 145 |
146 set (ax(1), "ycolor", getcolor (h1(1))); | |
7195 | 147 set (ax(1), "xlim", xlim); |
148 | |
149 cf = gcf (); | |
150 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
|
151 |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
152 if (ishandle(ax(2)) && strcmp (get (ax(2), "type"), "axes")) |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
153 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
|
154 else |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
155 ax(2) = axes (); |
52f2fba4f3f8
Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
156 endif |
7665
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
157 newplot (); |
aead4b9d026b
Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents:
7314
diff
changeset
|
158 |
7195 | 159 colors = get (ax(1), "colororder"); |
160 set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]); | |
161 | |
162 h2 = feval (fun2, x2, y2); | |
7206 | 163 set (ax(2), "yaxislocation", "right"); |
7220 | 164 set (ax(2), "ycolor", getcolor (h2(1))); |
7240 | 165 set (ax(2), "position", get (ax(1), "position")); |
7195 | 166 set (ax(2), "xlim", xlim); |
7240 | 167 set (ax(2), "color", "none"); |
8208 | 168 |
169 ## Add invisible text objects that when destroyed, | |
170 ## also remove the other axis | |
171 t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy", | |
172 "handlevisibility", "off", "visible", "off", | |
173 "xliminclude", "off", "yliminclude", "off"); | |
174 t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy", | |
175 "handlevisibility", "off", "visible", "off", | |
176 "xliminclude", "off", "yliminclude", "off"); | |
177 | |
178 set (t1, "deletefcn", {@deleteplotyy, ax(2), t2}); | |
179 set (t2, "deletefcn", {@deleteplotyy, ax(1), t1}); | |
180 | |
181 addlistener (ax(1), "position", {@update_position, ax(2)}); | |
182 addlistener (ax(2), "position", {@update_position, ax(1)}); | |
183 addlistener (ax(1), "view", {@update_position, ax(2)}); | |
184 addlistener (ax(2), "view", {@update_position, ax(1)}); | |
11994
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
185 addlistener (ax(1), "dataaspectratio", {@update_position, ax(2)}); |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
186 addlistener (ax(2), "dataaspectratio", {@update_position, ax(1)}); |
8208 | 187 |
188 ## Tag the plotyy axes, so we can use that information | |
189 ## not to mirror the y axis tick marks | |
190 set (ax, "tag", "plotyy") | |
191 | |
11994
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
192 ## Store the axes handles for the sister axes. |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
193 addproperty ("__plotyy_axes__", ax(1), "data", ax); |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
194 addproperty ("__plotyy_axes__", ax(2), "data", ax); |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
195 |
8208 | 196 endfunction |
197 | |
198 %!demo | |
8790
a013ff655ca4
Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents:
8769
diff
changeset
|
199 %! clf |
8208 | 200 %! x = 0:0.1:2*pi; |
201 %! y1 = sin (x); | |
202 %! y2 = exp (x - 1); | |
203 %! ax = plotyy (x, y1, x - 1, y2, @plot, @semilogy); | |
204 %! xlabel ("X"); | |
205 %! ylabel (ax(1), "Axis 1"); | |
206 %! ylabel (ax(2), "Axis 2"); | |
207 | |
11994
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
208 %!demo |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
209 %! clf |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
210 %! x = linspace (-1, 1, 201); |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
211 %! subplot (2, 2, 1) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
212 %! plotyy (x, sin(pi*x), x, 10*cos(pi*x)) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
213 %! subplot (2, 2, 2) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
214 %! surf (peaks (25)) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
215 %! subplot (2, 2, 3) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
216 %! contour (peaks (25)) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
217 %! subplot (2, 2, 4) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
218 %! plotyy (x, 10*sin(2*pi*x), x, cos(2*pi*x)) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
219 %! axis square |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
220 |
8208 | 221 function deleteplotyy (h, d, ax2, t2) |
222 if (ishandle (ax2) && strcmp (get (ax2, "type"), "axes") && | |
223 (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")) && | |
224 strcmp (get (ax2, "beingdeleted"), "off")) | |
225 set (t2, "deletefcn", []); | |
226 delete (ax2); | |
227 endif | |
228 endfunction | |
229 | |
230 function update_position (h, d, ax2) | |
231 persistent recursion = false; | |
232 | |
233 ## Don't allow recursion | |
234 if (! recursion) | |
235 unwind_protect | |
236 recursion = true; | |
237 position = get (h, "position"); | |
238 view = get (h, "view"); | |
11994
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
239 dataaspectratio = get (h, "dataaspectratio"); |
8208 | 240 oldposition = get (ax2, "position"); |
241 oldview = get (ax2, "view"); | |
11994
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
242 olddataaspectratio = get (ax2, "dataaspectratio"); |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
243 if (! (isequal (position, oldposition) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
244 && isequal (view, oldview) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
245 && isequal (dataaspectratio, olddataaspectratio))) |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
246 set (ax2, "position", position, |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
247 "view", view, |
f944142010ce
plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents:
11993
diff
changeset
|
248 "dataaspectratio", dataaspectratio); |
8208 | 249 endif |
250 unwind_protect_cleanup | |
251 recursion = false; | |
252 end_unwind_protect | |
253 endif | |
7195 | 254 endfunction |
7220 | 255 |
256 function color = getcolor (ax) | |
257 obj = get (ax); | |
258 if (isfield (obj, "color")) | |
259 color = obj.color; | |
260 elseif (isfield (obj, "facecolor") && ! ischar (obj.facecolor)) | |
261 color = obj.facecolor; | |
262 elseif (isfield (obj, "edgecolor") && ! ischar (obj.edgecolor)) | |
263 color = obj.edgecolor; | |
264 else | |
265 color = [0, 0, 0]; | |
266 endif | |
267 endfunction | |
7245 | 268 |