changeset 26217:31267a10f8a9

Use __go_line__ directly in plot scripts for performance. * legend.m, plot3.m, __bar__.m, __stem__.m: Replace instances of line() with __go_line__().
author Rik <rik@octave.org>
date Wed, 12 Dec 2018 20:56:58 -0800
parents 96b6b69a1575
children 29387b9ccfbb
files scripts/plot/appearance/legend.m scripts/plot/draw/plot3.m scripts/plot/draw/private/__bar__.m scripts/plot/draw/private/__stem__.m
diffstat 4 files changed, 43 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Wed Dec 12 22:32:26 2018 -0500
+++ b/scripts/plot/appearance/legend.m	Wed Dec 12 20:56:58 2018 -0800
@@ -877,22 +877,24 @@
               style = get (hplt, "linestyle");
               lwidth = min (get (hplt, "linewidth"), 5);
               if (! strcmp (style, "none"))
-                l1 = line ("xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3),
-                           "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4),
-                           "color", color, "linestyle", style, "linewidth", lwidth,
-                           "marker", "none");
+                l1 = __go_line__ (hlegend, ...
+                       "xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3), ...
+                       "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4), ...
+                       "color", color, "linestyle", style, ...
+                       "linewidth", lwidth, "marker", "none");
                 setappdata (l1, "handle", hplt);
                 hobjects(end+1) = l1;
               endif
               marker = get (hplt, "marker");
               if (! strcmp (marker, "none"))
-                l1 = line ("xdata", (xoffset + 0.5 * linelength  + xk * xstep) / lpos(3),
-                           "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4),
-                           "color", color, "linestyle", "none", "linewidth", lwidth,
-                           "marker", marker,
-                           "markeredgecolor", get (hplt, "markeredgecolor"),
-                           "markerfacecolor", get (hplt, "markerfacecolor"),
-                           "markersize", min (get (hplt, "markersize"),10));
+                l1 = __go_line__ (hlegend, ...
+                       "xdata", (xoffset + 0.5 * linelength  + xk * xstep) / lpos(3), ...
+                       "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4), ...
+                       "color", color, "linestyle", "none", ...
+                       "linewidth", lwidth, "marker", marker, ...
+                       "markeredgecolor", get (hplt, "markeredgecolor"), ...
+                       "markerfacecolor", get (hplt, "markerfacecolor"), ...
+                       "markersize", min (get (hplt, "markersize"),10));
                 setappdata (l1, "handle", hplt);
                 hobjects(end+1) = l1;
               endif
@@ -1310,21 +1312,21 @@
     endif
 
     if (! strcmp (linestyle, "none"))
-      hl = line ("xdata", xpos1, "ydata", ypos1, "color", get (h, "color"),
-                 "linestyle", get (h, "linestyle"),
-                 "linewidth", min (get (h, "linewidth"), 5),
-                 "marker", "none",
-                 "parent", hlegend);
+      hl = __go_line__ (hlegend, "xdata", xpos1, "ydata", ypos1,
+                        "color", get (h, "color"),
+                        "linestyle", get (h, "linestyle"),
+                        "linewidth", min (get (h, "linewidth"), 5),
+                        "marker", "none");
       setappdata (hl, "handle", h);
     endif
     if (! strcmp (marker, "none"))
-      hl = line ("xdata", xpos2, "ydata", ypos2, "color", get (h, "color"),
-                 "marker", marker, "markeredgecolor", get (h, "markeredgecolor"),
-                 "markerfacecolor", get (h, "markerfacecolor"),
-                 "markersize", min (get (h, "markersize"), 10),
-                 "linestyle", "none",
-                 "linewidth", min (get (h, "linewidth"), 5),
-                 "parent", hlegend);
+      hl = __go_line__ (hlegend, "xdata", xpos2, "ydata", ypos2, ...
+                        "color", get (h, "color"), ...
+                        "marker", marker, "markeredgecolor", get (h, "markeredgecolor"), ...
+                        "markerfacecolor", get (h, "markerfacecolor"), ...
+                        "markersize", min (get (h, "markersize"), 10), ...
+                        "linestyle", "none", ...
+                        "linewidth", min (get (h, "linewidth"), 5));
       setappdata (hl, "handle", h);
     endif
   endif
--- a/scripts/plot/draw/plot3.m	Wed Dec 12 22:32:26 2018 -0500
+++ b/scripts/plot/draw/plot3.m	Wed Dec 12 20:56:58 2018 -0800
@@ -213,9 +213,10 @@
             color = __next_line_color__ ();
           endif
 
-          htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
-                              "color", color, "linestyle", linestyle,
-                              "marker", marker, properties{:});
+          htmp(++idx) = __go_line__ (hax, "xdata", x(:, i), "ydata", y(:, i),
+                                     "zdata", z(:, i),
+                                     "color", color, "linestyle", linestyle,
+                                     "marker", marker, properties{:});
           key = options.key;
           if (! isempty (key))
             hlgnd = [hlgnd, htmp(idx)];
@@ -268,9 +269,10 @@
             color = __next_line_color__ ();
           endif
 
-          htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
-                              "color", color, "linestyle", linestyle,
-                              "marker", marker, properties{:});
+          htmp(++idx) = __go_line__ (hax, "xdata", x(:, i), "ydata", y(:, i),
+                                     "zdata", z(:, i),
+                                     "color", color, "linestyle", linestyle,
+                                     "marker", marker, properties{:});
           key = options.key;
           if (! isempty (key))
             hlgnd = [hlgnd, htmp(idx)];
@@ -343,9 +345,10 @@
           color = __next_line_color__ ();
         endif
 
-        htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
-                            "color", color, "linestyle", linestyle,
-                            "marker", marker, properties{:});
+        htmp(++idx) = __go_line__ (hax, "xdata", x(:, i), "ydata", y(:, i),
+                                   "zdata", z(:, i),
+                                   "color", color, "linestyle", linestyle,
+                                   "marker", marker, properties{:});
         key = options.key;
         if (! isempty (key))
           hlgnd = [hlgnd, htmp(idx)];
--- a/scripts/plot/draw/private/__bar__.m	Wed Dec 12 22:32:26 2018 -0500
+++ b/scripts/plot/draw/private/__bar__.m	Wed Dec 12 20:56:58 2018 -0800
@@ -282,8 +282,9 @@
     if (i == 1)
       ## Add baseline object the first time through loop
       x_axis_range = get (hax, "xlim");
-      h_baseline = line (hax, x_axis_range, [base_value, base_value],
-                             "color", [0, 0, 0]);
+      h_baseline = __go_line__ (hax, "xdata", x_axis_range,
+                                     "ydata", [base_value, base_value],
+                                     "color", [0, 0, 0]);
       set (h_baseline, "handlevisibility", "off", "xliminclude", "off");
       set (h_baseline, "parent", get (hg, "parent"));
     endif
--- a/scripts/plot/draw/private/__stem__.m	Wed Dec 12 22:32:26 2018 -0500
+++ b/scripts/plot/draw/private/__stem__.m	Wed Dec 12 20:56:58 2018 -0800
@@ -99,7 +99,9 @@
 
         x_axis_range = get (hax, "xlim");
         if (isempty (h_baseline))
-          h_baseline = line (hax, x_axis_range, [0, 0], "color", [0, 0, 0]);
+          h_baseline = __go_line__ (hax, "xdata", x_axis_range,
+                                         "ydata", [0, 0],
+                                         "color", [0, 0, 0]);
           set (h_baseline, "handlevisibility", "off", "xliminclude", "off");
           addproperty ("basevalue", h_baseline, "data", 0);
         else