# HG changeset patch # User Ben Abbott # Date 1245127436 -7200 # Node ID 9caef5712f40657ab13ac10325521091e77a3555 # Parent 6c6e0d81148b051d5540157075652636757e991b plotyy.m: Correct behavior when there is no currentfigure. diff -r 6c6e0d81148b -r 9caef5712f40 scripts/ChangeLog --- a/scripts/ChangeLog Tue Jun 16 06:43:56 2009 +0200 +++ b/scripts/ChangeLog Tue Jun 16 06:43:56 2009 +0200 @@ -1,3 +1,7 @@ +2009-06-14 Eric Chassande-Mottin + + * plot/plotyy.m: Correct behavior when there is no currentfigure. + 2009-06-11 Ben Abbott * plot/print.m: Fix logic associated with 'have_ghostscript'. diff -r 6c6e0d81148b -r 9caef5712f40 scripts/plot/plotyy.m --- a/scripts/plot/plotyy.m Tue Jun 16 06:43:56 2009 +0200 +++ b/scripts/plot/plotyy.m Tue Jun 16 06:43:56 2009 +0200 @@ -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 = {};