Mercurial > hg > octave-lyh
comparison scripts/plot/plotyy.m @ 17129:b5d6314314fc
Change various plot functions to take advantage of new isaxes() function.
* scripts/geometry/voronoi.m, scripts/image/imagesc.m,
scripts/plot/__plt_get_axis_arg__.m, scripts/plot/axes.m, scripts/plot/cla.m,
scripts/plot/colorbar.m, scripts/plot/hold.m, scripts/plot/legend.m,
scripts/plot/plotmatrix.m, scripts/plot/plotyy.m,
scripts/plot/private/__errplot__.m, scripts/plot/private/__plt__.m,
scripts/plot/view.m: Use new isaxes function to simplify code.
* scripts/plot/shading.m: Use Octave convention for spacing of parentheses.
* scripts/plot/zlabel.m: Correct %!test incorrectly calling plot3 with figure
handle.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 31 Jul 2013 16:27:49 -0700 |
parents | eaab03308c0b |
children |
comparison
equal
deleted
inserted
replaced
17128:7649779e6ebd | 17129:b5d6314314fc |
---|---|
113 | 113 |
114 unwind_protect | 114 unwind_protect |
115 [ax, h1, h2] = __plotyy__ (ax, varargin{:}); | 115 [ax, h1, h2] = __plotyy__ (ax, varargin{:}); |
116 unwind_protect_cleanup | 116 unwind_protect_cleanup |
117 ## Only change back to the old axis if we didn't delete it | 117 ## Only change back to the old axis if we didn't delete it |
118 if (ishandle (oldh) && strcmp (get (oldh, "type"), "axes")) | 118 if (isaxes (oldh)) |
119 axes (oldh); | 119 axes (oldh); |
120 endif | 120 endif |
121 end_unwind_protect | 121 end_unwind_protect |
122 | 122 |
123 if (nargout > 0) | 123 if (nargout > 0) |
140 fun2 = fun1; | 140 fun2 = fun1; |
141 endif | 141 endif |
142 | 142 |
143 xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])]; | 143 xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])]; |
144 | 144 |
145 if (ishandle (ax(1)) && strcmp (get (ax(1), "type"), "axes")) | 145 if (isaxes (ax(1))) |
146 axes (ax(1)); | 146 axes (ax(1)); |
147 else | 147 else |
148 ax(1) = axes (); | 148 ax(1) = axes (); |
149 endif | 149 endif |
150 newplot (); | 150 newplot (); |
155 set (ax(1), "color", "none"); | 155 set (ax(1), "color", "none"); |
156 | 156 |
157 cf = gcf (); | 157 cf = gcf (); |
158 set (cf, "nextplot", "add"); | 158 set (cf, "nextplot", "add"); |
159 | 159 |
160 if (ishandle (ax(2)) && strcmp (get (ax(2), "type"), "axes")) | 160 if (isaxes (ax(2))) |
161 axes (ax(2)); | 161 axes (ax(2)); |
162 else | 162 else |
163 ax(2) = axes (); | 163 ax(2) = axes (); |
164 set (ax(2), "nextplot", get (ax(1), "nextplot")); | 164 set (ax(2), "nextplot", get (ax(1), "nextplot")); |
165 endif | 165 endif |
287 %! title (hax(2), 'title'); | 287 %! title (hax(2), 'title'); |
288 %! ylabel (hax(1), 'Left axis is Blue'); | 288 %! ylabel (hax(1), 'Left axis is Blue'); |
289 %! ylabel (hax(2), 'Right axis is Green'); | 289 %! ylabel (hax(2), 'Right axis is Green'); |
290 | 290 |
291 function deleteplotyy (h, d, ax2, t2) | 291 function deleteplotyy (h, d, ax2, t2) |
292 if (ishandle (ax2) && strcmp (get (ax2, "type"), "axes") | 292 if (isaxes (ax2) |
293 && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")) | 293 && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")) |
294 && strcmp (get (ax2, "beingdeleted"), "off")) | 294 && strcmp (get (ax2, "beingdeleted"), "off")) |
295 set (t2, "deletefcn", []); | 295 set (t2, "deletefcn", []); |
296 delete (ax2); | 296 delete (ax2); |
297 endif | 297 endif |