changeset 22050:eb751495ba43

Condition grid_idx assignment on existence of axis_idx (bug #48401). * __gnuplot_draw_axes__.m: Move initialization of grid_idx to within the major/minor grid code and choose initial value based upon whether an axis was drawn.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Wed, 06 Jul 2016 15:11:14 -0500
parents ccf50f029999
children 6db928d06b07
files scripts/plot/util/private/__gnuplot_draw_axes__.m
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m	Wed Jul 06 14:57:54 2016 -0400
+++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m	Wed Jul 06 15:11:14 2016 -0500
@@ -1474,10 +1474,14 @@
     endif
   endif
 
-  grid_idx = axis_idx;
   if (! have_major_grid && ! have_minor_grid)
     fputs (plot_stream, "unset grid;\n");
   else
+    if (exist ("axis_idx", "var"))
+      grid_idx = axis_idx;
+    else
+      grid_idx = data_idx;
+    endif
     if (have_major_grid)
       grid_idx += 1;
       grid_obj.linestyle = axis_obj.gridlinestyle;