changeset 29107:f8afcf772ba0

__default_plot_options__.m: Document function and improve performance. * __default_plot_options__.m: Document function. Use single call to struct() which saves 30 milliseconds for me or -19% on execution time.
author Rik <rik@octave.org>
date Thu, 26 Nov 2020 18:39:22 -0800
parents c661350ee8df
children 5fc28dab0b2b
files scripts/plot/util/__default_plot_options__.m
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/__default_plot_options__.m	Thu Nov 26 18:25:42 2020 -0800
+++ b/scripts/plot/util/__default_plot_options__.m	Thu Nov 26 18:39:22 2020 -0800
@@ -25,16 +25,17 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {} {@var{options} =} __default_plot_options__ ()
-## Undocumented internal function.
+## Return a plot options structure @var{options} with default values
+## for all fields.
 ## @end deftypefn
 
 function options = __default_plot_options__ ()
 
-  options.key = "";
-  options.color = [];
-  options.linestyle = [];
-  options.marker = [];
-  options.errorstyle = [];
+  options = struct ("key", "",
+                    "color", [],
+                    "linestyle", [],
+                    "marker", [],
+                    "errorstytle", []);
 
 endfunction