Mercurial > hg > octave-nkf
diff scripts/plot/plotyy.m @ 11993:9caef5712f40 release-3-2-x
plotyy.m: Correct behavior when there is no currentfigure.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Tue, 16 Jun 2009 06:43:56 +0200 |
parents | dbd0c77e575e |
children | 93664cbb732c |
line wrap: on
line diff
--- a/scripts/plot/plotyy.m +++ b/scripts/plot/plotyy.m @@ -73,21 +73,19 @@ else f = get (0, "currentfigure"); if (isempty (f)) + f = figure (); + endif + ax = get (f, "children"); + if (length (ax) > 2) + for i = 3 : length (ax) + delete (ax (i)); + endfor + ax = ax(1:2); + elseif (length (ax) == 1) + ax(2) = axes (); + elseif (isempty (ax)) ax(1) = axes (); ax(2) = axes (); - else - ax = get (f, "children"); - if (length (ax) > 2) - for i = 3 : length (ax) - delete (ax (i)); - endfor - ax = ax(1:2); - elseif (length (ax) == 1) - ax(2) = axes (); - elseif (isempty (ax)) - ax(1) = axes (); - ax(2) = axes (); - endif endif if (nargin < 2) varargin = {};