changeset 22040:79e7a6fc524d

Add control of grid lines for gnuplot toolkit (bug #48401). * __gnuplot_draw_axes__.m: Remove grid commands from before data commands to after data commands, and use a linetype via do_linestyle_command() for dashtype, color and linewidth control. (do_linestyle_command): Condition the extra linetype command on the presence of points on the plot.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Tue, 05 Jul 2016 13:00:00 -0500
parents 0a528a6dac95
children 26c0e65e6b77
files scripts/plot/util/private/__gnuplot_draw_axes__.m
diffstat 1 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m	Tue Jul 05 11:07:55 2016 -0700
+++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m	Tue Jul 05 13:00:00 2016 -0500
@@ -358,13 +358,6 @@
     fputs (plot_stream, "set border back;\n");
   endif
 
-  fprintf (plot_stream, "set grid linewidth %f, linewidth %f;\n",
-           axis_obj.linewidth, axis_obj.linewidth);
-
-  if (! have_grid)
-    fputs (plot_stream, "unset grid;\n");
-  endif
-
   xlogscale = strcmpi (axis_obj.xscale, "log");
   ylogscale = strcmpi (axis_obj.yscale, "log");
   zlogscale = strcmpi (axis_obj.zscale, "log");
@@ -1476,6 +1469,23 @@
     endif
   endif
 
+  grid_idx = axis_idx;
+  if (! have_grid)
+    fputs (plot_stream, "unset grid;\n");
+  else
+    grid_idx += 1;
+    grid_obj.linestyle = axis_obj.gridlinestyle;
+    grid_obj.linewidth = axis_obj.linewidth;
+    [style, sidx] = do_linestyle_command (grid_obj, axis_obj.gridcolor,
+                                          grid_idx, plot_stream);
+    if (__gnuplot_has_feature__ ("linetype"))
+      scmd = "linetype";
+    else
+      scmd = "linestyle";
+    endif
+    fprintf (plot_stream, "set grid %s %d, %s %d;\n", scmd, sidx, scmd, sidx);
+  endif
+
   if (! isempty (hlgnd) && ! isempty (hlgnd.children)
       && any (strcmpi (get (hlgnd.children, "visible"), "on")))
     if (strcmpi (hlgnd.box, "on"))
@@ -1901,7 +1911,7 @@
         endif
       endif
     endif
-    if (isfield (obj, "markeredgecolor")
+    if (! isempty(pt) && isfield (obj, "markeredgecolor")
         && ! strcmp (obj.markeredgecolor, "none"))
       if (facesame && ! isempty (pt)
           && (strcmp (obj.markeredgecolor, "auto")