diff scripts/plot/private/__next_line_style__.m @ 16943:0dab17e69a55

Implement line color and style rotation across multiple axes (bug #39344). * scripts/plot/private/__next_line_color__.m: Get ColorOrder from gca rather than using persistent variable. * scripts/plot/private/__next_line_style__.m: Get LineStyleOrder from gca rather than using persistent variable.
author Carl Osterwisch <costerwisch@costerwisch-lt1>
date Tue, 09 Jul 2013 18:53:06 -0700
parents 78a2f43bbc69
children 22ec459cf7ba
line wrap: on
line diff
--- a/scripts/plot/private/__next_line_style__.m	Tue Jun 25 14:48:33 2013 -0400
+++ b/scripts/plot/private/__next_line_style__.m	Tue Jul 09 18:53:06 2013 -0700
@@ -28,32 +28,33 @@
 
   persistent reset_style = true;
 
-  if (nargin < 2)
-    if (nargin == 1)
-      % Indicates whether the next call will increment or not
-      reset_style = reset;
-    else
-      % Find and return the next line style
-      ca = gca();
-      style_rotation = get (ca, "linestyleorder");
-      if (ischar (style_rotation))
-        style_rotation = strsplit (style_rotation, "|");
-      endif
-      nStyles = length (style_rotation);
-      if reset_style || (nStyles < 2)
-        style_index = 1;
-      else
-        % Executed when "hold all" is active
-        nChildren = length(get(ca, "Children"));
-        nColors = length(get(ca, "ColorOrder"));
-        style_index = mod(floor(nChildren/nColors), nStyles) + 1;
-      endif
-      options = __pltopt__ ("__next_line_style__",
-                            style_rotation (style_index));
-      linestyle = options.linestyle;
-      marker = options.marker;
-    endif
-  else
+  if (nargin > 1)
     print_usage ();
   endif
+
+  if (nargin == 1)
+    ## Indicates whether the next call will increment or not
+    reset_style = reset;
+  else
+    ## Find and return the next line style
+    ca = gca ();
+    style_rotation = get (ca, "linestyleorder");
+    if (ischar (style_rotation))
+      style_rotation = strsplit (style_rotation, "|");
+    endif
+    nStyles = length (style_rotation);
+    if (reset_style || (nStyles < 2))
+      style_index = 1;
+    else
+      ## Executed when "hold all" is active
+      nChildren = length (get (ca, "Children"));
+      nColors = length (get (ca, "ColorOrder"));
+      style_index = mod (floor (nChildren/nColors), nStyles) + 1;
+    endif
+    options = __pltopt__ ("__next_line_style__",
+                          style_rotation(style_index));
+    linestyle = options.linestyle;
+    marker = options.marker;
+  endif
+
 endfunction