# HG changeset patch # User Ben Abbott # Date 1245010212 14400 # Node ID d50c3d8efe7114b1199f3b60304e249d3e4892ae # Parent dbc61d4e428d07c2d4bc5994dba7608e99461cdb plotyy.m: Correct behavior when there is no currentfigure. diff -r dbc61d4e428d -r d50c3d8efe71 scripts/ChangeLog --- a/scripts/ChangeLog Sun Jun 14 11:57:52 2009 +0200 +++ b/scripts/ChangeLog Sun Jun 14 16:10:12 2009 -0400 @@ -1,3 +1,7 @@ +2009-06-14 Eric Chassande-Mottin + + * plot/plotyy.m: Correct behavior when there is no currentfigure. + 2009-06-14 Jaroslav Hajek * set/ismember.m: Reimplement using lookup & unique. diff -r dbc61d4e428d -r d50c3d8efe71 scripts/plot/plotyy.m --- a/scripts/plot/plotyy.m Sun Jun 14 11:57:52 2009 +0200 +++ b/scripts/plot/plotyy.m Sun Jun 14 16:10:12 2009 -0400 @@ -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 = {};