changeset 31036:a357490263f6

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 27 May 2022 15:58:10 +0200
parents bb9c7512e090 (current diff) 7c4e580bc103 (diff)
children 39ca6d0b63e4
files etc/NEWS.7.md scripts/plot/util/__pltopt__.m
diffstat 2 files changed, 25 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.7.md	Thu May 26 19:47:47 2022 +0200
+++ b/etc/NEWS.7.md	Fri May 27 15:58:10 2022 +0200
@@ -362,6 +362,10 @@
   and a warning is now emitted if it is used, but it will continue to
   work.
 
+- Using numbers to select line colors in short hand formats was an
+  un-documented feature that is deprecated in Octave 7 and will be
+  removed from Octave 9.
+
 
 ### Removed functions, properties, and features
 
--- a/scripts/plot/util/__pltopt__.m	Thu May 26 19:47:47 2022 +0200
+++ b/scripts/plot/util/__pltopt__.m	Fri May 27 15:58:10 2022 +0200
@@ -158,6 +158,12 @@
     topt = opt(1);
     n = 1;
 
+    if (any (topt == "0":"6"))
+      warning ("Octave:deprecated-option", ...
+               ["%s: using numbers to select line colors is deprecated.  ", ...
+                "Use the corresponding color identifier instead."], caller);
+    endif
+
     ## LineStyles
     if (strncmp (opt, "--", 2) || strncmp (opt, "-.", 2))
       options.linestyle = opt(1:2);
@@ -181,21 +187,28 @@
           n = 9;
         endif
       endif
+      ## Backward compatibility.  Leave undocumented.
+      if (topt == "@")
+        warning ("Octave:deprecated-option", ...
+                 "%s: marker type '@' is deprecated.  Use '+' instead.", ...
+                 caller);
+        topt = "+";
+      endif
       options.marker = topt;
-    ## Color specs
-    elseif (topt == "k")
+    ## Numeric color specs are for backward compatibility.  Don't document.
+    elseif (topt == "k" || topt == "0")
       options.color = [0, 0, 0];
-    elseif (topt == "r")
+    elseif (topt == "r" || topt == "1")
       if (strncmp (opt, "red", 3))
         n = 3;
       endif
       options.color = [1, 0, 0];
-    elseif (topt == "g")
+    elseif (topt == "g" || topt == "2")
       if (strncmp (opt, "green", 5))
         n = 5;
       endif
       options.color = [0, 1, 0];
-    elseif (topt == "b")
+    elseif (topt == "b" || topt == "3")
       if (strncmp (opt, "black", 5))
         options.color = [0, 0, 0];
         n = 5;
@@ -210,17 +223,17 @@
         n = 6;
       endif
       options.color = [1, 1, 0];
-    elseif (topt == "m")
+    elseif (topt == "m" || topt == "4")
       if (strncmp (opt, "magenta", 7))
         n = 7;
       endif
       options.color = [1, 0, 1];
-    elseif (topt == "c")
+    elseif (topt == "c" || topt == "5")
       if (strncmp (opt, "cyan", 4))
         n = 4;
       endif
       options.color = [0, 1, 1];
-    elseif (topt == "w")
+    elseif (topt == "w" || topt == "6")
       if (strncmp (opt, "white", 5))
         n = 5;
       endif