Mercurial > octave
changeset 24146:d72ba9191352
Handle x-axis and y-axis independently for proper axis lines and tick marks (bug #52141)
* __gnuplot_draw_axes__.m: Move do_border_2d() sooner and un-conditioned on
no (empty) y-ticks, thereby addressing missing axis lines. Condense
duplicate x-tick processing code into a separate group of if-else tests even
in the empty y-tick scenario, thereby addressing extra mirrored x-ticks.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Wed, 04 Oct 2017 14:13:49 -0500 |
parents | 196ea1ee99b8 |
children | 9fab3273ff26 |
files | scripts/plot/util/private/__gnuplot_draw_axes__.m |
diffstat | 1 files changed, 13 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m Fri Sep 29 08:45:51 2017 -0700 +++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m Wed Oct 04 14:13:49 2017 -0500 @@ -1486,43 +1486,20 @@ else if (nd == 3) do_border_tick_3d (axis_obj, plot_stream); - elseif (! isempty (axis_obj.ytick)) - if (strcmp (axis_obj.yaxislocation, "right")) - fprintf (plot_stream, "unset ytics; set y2tics %s nomirror\n", - axis_obj.tickdir); - if (strcmp (axis_obj.xaxislocation, "top")) - maybe_do_x2tick_mirror (plot_stream, axis_obj) - elseif (strcmp (axis_obj.xaxislocation, "bottom")) - maybe_do_xtick_mirror (plot_stream, axis_obj) - else # xaxislocation == "origin" or "zero" - fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n", - axis_obj.tickdir); - endif - elseif (strcmp (axis_obj.yaxislocation, "left")) - fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n", - axis_obj.tickdir); - if (strcmp (axis_obj.xaxislocation, "top")) - maybe_do_x2tick_mirror (plot_stream, axis_obj) - elseif (strcmp (axis_obj.xaxislocation, "bottom")) - maybe_do_xtick_mirror (plot_stream, axis_obj) - else # xaxislocation == "origin" or "zero" - maybe_do_xtick_mirror (plot_stream, axis_obj) - endif - else # yaxislocation == "origin" or "zero" - fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n", - axis_obj.tickdir); - if (strcmp (axis_obj.xaxislocation, "top")) - maybe_do_x2tick_mirror (plot_stream, axis_obj) - elseif (strcmp (axis_obj.xaxislocation, "bottom")) - maybe_do_xtick_mirror (plot_stream, axis_obj) - else # xaxislocation == "origin" or "zero" - maybe_do_xtick_mirror (plot_stream, axis_obj) - fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n", - axis_obj.tickdir); - fputs (plot_stream, "unset border;\n"); - endif + else + axis_idx = do_border_2d (axis_obj, plot_stream, axis_idx); + if (isempty (axis_obj.xtick)) + elseif (strcmp (axis_obj.xaxislocation, "top")) + fprintf (plot_stream, "set x2tics %s nomirror\n", axis_obj.tickdir); + else # xaxislocation == "bottom", "origin" or "zero" + fprintf (plot_stream, "set xtics %s nomirror\n", axis_obj.tickdir); endif - axis_idx = do_border_2d (axis_obj, plot_stream, axis_idx); + if (isempty (axis_obj.ytick)) + elseif (strcmp (axis_obj.yaxislocation, "right")) + fprintf (plot_stream, "set y2tics %s nomirror\n", axis_obj.tickdir); + else # yaxislocation == "left", "origin" or "zero" + fprintf (plot_stream, "set ytics %s nomirror\n", axis_obj.tickdir); + endif endif endif endif @@ -2876,24 +2853,6 @@ endfunction -function maybe_do_xtick_mirror (plot_stream, axis_obj) - - if (! isempty(axis_obj.xtick)) - fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n", - axis_obj.tickdir); - endif - -endfunction - -function maybe_do_x2tick_mirror (plot_stream, axis_obj) - - if (! isempty(axis_obj.xtick)) - fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n", - axis_obj.tickdir); - endif - -endfunction - function retval = mapcdata (cdata, mode, clim, cmap_sz) if (ndims (cdata) == 3) ## True Color, clamp data to 8-bit