Mercurial > hg > octave-lyh
changeset 9346:d50c3d8efe71
plotyy.m: Correct behavior when there is no currentfigure.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 14 Jun 2009 16:10:12 -0400 |
parents | dbc61d4e428d |
children | 3da821b161e9 |
files | scripts/ChangeLog scripts/plot/plotyy.m |
diffstat | 2 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-06-14 Eric Chassande-Mottin <echassandemottin@gmail.com> + + * plot/plotyy.m: Correct behavior when there is no currentfigure. + 2009-06-14 Jaroslav Hajek <highegg@gmail.com> * set/ismember.m: Reimplement using lookup & unique.
--- 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 = {};