comparison scripts/plot/plotyy.m @ 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 dbd0c77e575e
children 93664cbb732c
comparison
equal deleted inserted replaced
9345:dbc61d4e428d 9346:d50c3d8efe71
71 error ("plotyy: expecting first argument to be axes handle"); 71 error ("plotyy: expecting first argument to be axes handle");
72 endif 72 endif
73 else 73 else
74 f = get (0, "currentfigure"); 74 f = get (0, "currentfigure");
75 if (isempty (f)) 75 if (isempty (f))
76 f = figure ();
77 endif
78 ax = get (f, "children");
79 if (length (ax) > 2)
80 for i = 3 : length (ax)
81 delete (ax (i));
82 endfor
83 ax = ax(1:2);
84 elseif (length (ax) == 1)
85 ax(2) = axes ();
86 elseif (isempty (ax))
76 ax(1) = axes (); 87 ax(1) = axes ();
77 ax(2) = axes (); 88 ax(2) = axes ();
78 else
79 ax = get (f, "children");
80 if (length (ax) > 2)
81 for i = 3 : length (ax)
82 delete (ax (i));
83 endfor
84 ax = ax(1:2);
85 elseif (length (ax) == 1)
86 ax(2) = axes ();
87 elseif (isempty (ax))
88 ax(1) = axes ();
89 ax(2) = axes ();
90 endif
91 endif 89 endif
92 if (nargin < 2) 90 if (nargin < 2)
93 varargin = {}; 91 varargin = {};
94 endif 92 endif
95 endif 93 endif