changeset 31035:7c4e580bc103 stable

plot: Deprecate using numbers to select line colors (bug #62470). * scripts/plot/util/__pltopt__.m (decode_linespec): Deprecate un-documented marker style and color identifiers. * etc/NEWS.7.md: Add note about deprecated feature to NEWS file.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 27 May 2022 15:57:08 +0200
parents 399925c27b7c
children a357490263f6 39876ea8c588
files etc/NEWS.7.md scripts/plot/util/__pltopt__.m
diffstat 2 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.7.md	Fri May 27 14:46:29 2022 +0200
+++ b/etc/NEWS.7.md	Fri May 27 15:57:08 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	Fri May 27 14:46:29 2022 +0200
+++ b/scripts/plot/util/__pltopt__.m	Fri May 27 15:57:08 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,10 +187,13 @@
           n = 9;
         endif
       endif
-        ## Backward compatibility.  Leave undocumented.
-        if (topt == "@")
-          topt = "+";
-        endif
+      ## Backward compatibility.  Leave undocumented.
+      if (topt == "@")
+        warning ("Octave:deprecated-option", ...
+                 "%s: marker type '@' is deprecated.  Use '+' instead.", ...
+                 caller);
+        topt = "+";
+      endif
       options.marker = topt;
     ## Numeric color specs are for backward compatibility.  Don't document.
     elseif (topt == "k" || topt == "0")