changeset 25340:d67d5c42f39b stable

lines.m: Don't open empty figure or axes if none already exist (bug #53648) * lines.m: use default axes "colororder" property when no current axes exist.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Wed, 02 May 2018 18:38:56 +0200
parents 1eef836d8d06
children 087030cf86a0
files scripts/image/lines.m
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/image/lines.m	Wed May 02 08:57:12 2018 +0200
+++ b/scripts/image/lines.m	Wed May 02 18:38:56 2018 +0200
@@ -30,6 +30,7 @@
 
 function map = lines (n)
 
+  hf = get (groot, "currentfigure");
   if (nargin > 1)
     print_usage ();
   elseif (nargin == 1)
@@ -38,17 +39,22 @@
     endif
     n = double (n);
   else
-    hf = get (0, "currentfigure");
     if (! isempty (hf))
       n = rows (get (hf, "colormap"));
     else
       n = 64;
     endif
   endif
+
   if (n == 1)
     map = [0, 0, 1];
   elseif (n > 1)
-    C = get (gca, "colororder");
+    hax = get (hf, "currentaxes");
+    if (! isempty (hax))
+      C = get (hax, "colororder");
+    else
+      C = get (groot, "defaultaxescolororder");
+    endif
     nr = rows (C);
     map = C(rem (0:(n-1), nr) + 1, :);
   else