Mercurial > octave-dspies
diff scripts/plot/__go_draw_axes__.m @ 9374:6a035159ba0e
grid.m: Add missing semi-colon. Fix grid toggle. Allow minor grid when no minor tick.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Mon, 22 Jun 2009 18:34:41 -0400 |
parents | a00e219c402d |
children | bac81ac76a57 |
line wrap: on
line diff
--- a/scripts/plot/__go_draw_axes__.m Mon Jun 22 17:10:01 2009 -0400 +++ b/scripts/plot/__go_draw_axes__.m Mon Jun 22 18:34:41 2009 -0400 @@ -226,7 +226,12 @@ if (strcmpi (axis_obj.xminorgrid, "on")) have_grid = true; - fprintf (plot_stream, "set m%stics 5;\n", xaxisloc); + if (strcmp (axis_obj.xscale, "log")) + m = 10; + else + m = 5; + endif + fprintf (plot_stream, "set m%stics %d;\n", xaxisloc, m); fprintf (plot_stream, "set grid m%stics;\n", xaxisloc); else fprintf (plot_stream, "set grid nom%stics;\n", xaxisloc); @@ -234,7 +239,12 @@ if (strcmpi (axis_obj.yminorgrid, "on")) have_grid = true; - fprintf (plot_stream, "set m%stics 5;\n", yaxisloc); + if (strcmp (axis_obj.yscale, "log")) + m = 10; + else + m = 5; + endif + fprintf (plot_stream, "set m%stics %d;\n", yaxisloc, m); fprintf (plot_stream, "set grid m%stics;\n", yaxisloc); else fprintf (plot_stream, "set grid nom%stics;\n", yaxisloc); @@ -242,7 +252,12 @@ if (strcmpi (axis_obj.zminorgrid, "on")) have_grid = true; - fputs (plot_stream, "set mztics 5;\n"); + if (strcmp (axis_obj.zscale, "log")) + m = 10; + else + m = 5; + endif + fprintf (plot_stream, "set mztics %d;\n", m); fputs (plot_stream, "set grid mztics;\n"); else fputs (plot_stream, "set grid nomztics;\n"); @@ -1535,6 +1550,16 @@ obj.yticklabel = ticklabel_to_cell (obj.yticklabel); obj.zticklabel = ticklabel_to_cell (obj.zticklabel); + if (strcmp (obj.xminorgrid, "on")) + obj.xminortick = "on"; + endif + if (strcmp (obj.yminorgrid, "on")) + obj.yminortick = "on"; + endif + if (strcmp (obj.zminorgrid, "on")) + obj.zminortick = "on"; + endif + [fontname, fontsize] = get_fontname_and_size (obj); fontspec = create_fontspec (fontname, fontsize, gnuplot_term); @@ -1613,8 +1638,10 @@ endif if (strcmp (scale, "log")) fmt = "10^{%T}"; + num_mtics = 10; else fmt = "%g"; + num_mtics = 5; endif colorspec = get_text_colorspec (color, mono); if (strcmpi (ticmode, "manual") || strcmpi (labelmode, "manual")) @@ -1655,7 +1682,7 @@ endfor fprintf (plot_stream, ") %s %s;\n", colorspec, fontspec); if (strcmp (mtics, "on")) - fprintf (plot_stream, "set m%stics 5;\n", ax); + fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics); else fprintf (plot_stream, "unset m%stics;\n", ax); endif @@ -1674,7 +1701,7 @@ fprintf (plot_stream, " %.15g,", tics(1:end-1)); fprintf (plot_stream, " %.15g) %s;\n", tics(end), fontspec); if (strcmp (mtics, "on")) - fprintf (plot_stream, "set m%stics 5;\n", ax); + fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics); else fprintf (plot_stream, "unset m%stics;\n", ax); endif @@ -1689,7 +1716,7 @@ tickdir, ticklength, axispos, colorspec, fontspec); endif if (strcmp (mtics, "on")) - fprintf (plot_stream, "set m%stics 5;\n", ax); + fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics); else fprintf (plot_stream, "unset m%stics;\n", ax); endif