changeset 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 6c6e0d81148b
children f944142010ce
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-11  Ben Abbott <bpabbott@mac.com>
 
 	* plot/print.m: Fix logic associated with 'have_ghostscript'.
--- 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 = {};