Mercurial > octave
changeset 21842:7da4671f3a5b
Correct gnuplot toolkit 3D box 'on'/'off' control (bug #47974).
* __gnuplot_draw_axes__.m: If 3D box on or off, call do_border_tick_3d()
instead of just setting gnuplot border integer.
(do_border_2d): Follow whitespace convention.
(do_border_tick_3d): Added. If box on, activate all borders and set mirror
string to 'mirror'. If box off, deactivate borders associated with the
roving ticks and text strings and set mirror string to 'nomirror'. Call new
function tick() with appropriate axis color, tick direction and mirror
string for all three axes.
(do_border_tick_3d.tick): Added. Construct the color specification for tick
text then set the ticks for the axis specified by axis character 'x', 'y'
or 'z'.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Tue, 07 Jun 2016 01:09:08 -0500 |
parents | cf690a73a186 |
children | f7a57b07c81d |
files | scripts/plot/util/private/__gnuplot_draw_axes__.m |
diffstat | 1 files changed, 38 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m Wed Jun 08 14:48:12 2016 -0700 +++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m Tue Jun 07 01:09:08 2016 -0500 @@ -1415,13 +1415,13 @@ axis_idx = data_idx; if (strcmpi (axis_obj.box, "on")) if (nd == 3) - fputs (plot_stream, "set border 4095;\n"); + do_border_tick_3d (axis_obj, plot_stream); else axis_idx = do_border_2d (axis_obj, plot_stream, axis_idx); endif else if (nd == 3) - fputs (plot_stream, "set border 895;\n"); + do_border_tick_3d (axis_obj, plot_stream); elseif (! isempty (axis_obj.ytick)) if (strcmpi (axis_obj.yaxislocation, "right")) fprintf (plot_stream, "unset ytics; set y2tics %s nomirror\n", @@ -1726,16 +1726,16 @@ fprintf (plot_stream, "set border 0\n"); if (strcmp (obj.box, "on") || strcmp (obj.xaxislocation, "bottom")) - arrow (1, obj.xcolor, obj.linewidth, [0,0,0],[1,0,0]); + arrow (1, obj.xcolor, obj.linewidth, [0,0,0], [1,0,0]); endif if (strcmp (obj.box, "on") || strcmp (obj.xaxislocation, "top")) - arrow (2, obj.xcolor, obj.linewidth, [0,1,0],[1,1,0]); + arrow (2, obj.xcolor, obj.linewidth, [0,1,0], [1,1,0]); endif if (strcmp (obj.box, "on") || strcmp (obj.yaxislocation, "left")) - arrow (3, obj.ycolor, obj.linewidth, [0,0,0],[0,1,0]); + arrow (3, obj.ycolor, obj.linewidth, [0,0,0], [0,1,0]); endif if (strcmp (obj.box, "on") || strcmp (obj.yaxislocation, "right")) - arrow (4, obj.ycolor, obj.linewidth, [1,0,0],[1,1,0]); + arrow (4, obj.ycolor, obj.linewidth, [1,0,0], [1,1,0]); endif if (strcmp (obj.xaxislocation, "zero")) @@ -1763,6 +1763,38 @@ endfunction +function idx = do_border_tick_3d (obj, plot_stream, idx) + + ## axis location has no effect + + if (strcmp (obj.box, "on")) + fputs (plot_stream, "set border 0xFFF;\n"); + mirrorstr = "mirror"; + else + fputs (plot_stream, "set border 0x15;\n"); + mirrorstr = "nomirror"; + endif + + tick ('x', obj.xcolor, obj.tickdir, mirrorstr); + tick ('y', obj.ycolor, obj.tickdir, mirrorstr); + tick ('z', obj.zcolor, obj.tickdir, mirrorstr); + + function tick (axischar, color, tickdir, mirrorstr); + if (isnumeric (color)) + if (length (color) == 3) + colorspec = sprintf ("rgb \"#%02x%02x%02x\"", round (255*color)); + else + colorspec = sprintf ("palatte %d", round (color)); + endif + else + colorspec = sprintf ("\"%s\"", color); + endif + fprintf (plot_stream, "set %ctics %s %s textcolor %s\n", + axischar, tickdir, mirrorstr, colorspec); + endfunction + +endfunction + function [style, ltidx] = do_linestyle_command (obj, linecolor, idx, plot_stream, errbars = "") idx = idx + 8;