Mercurial > hg > octave-nkf
changeset 18992:6a8cd989c69a
remove unneeded ticklabel conversions
* scripts/plot/util/private/__go_draw_axes__.m (do_tics_1):
Remove unneeded conversion of variable labels. Conversion is already
done in function do_tics with subfunction ticklabel_to_cell.
* scripts/plot/util/private/__go_draw_axes__.m (ticklabel_to_cell):
Simplify function, since most conversions are done in graphics.cc,
See bug #34906 for reference.
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Sun, 02 Mar 2014 02:29:52 +0100 |
parents | d368575195d4 |
children | 0dae39867b2b |
files | scripts/plot/util/private/__go_draw_axes__.m |
diffstat | 1 files changed, 20 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/private/__go_draw_axes__.m +++ b/scripts/plot/util/private/__go_draw_axes__.m @@ -2158,35 +2158,22 @@ fprintf (plot_stream, " %.15g) %s;\n", tics(end), fontspec); endif if (strcmpi (labelmode, "manual")) - if (ischar (labels)) - labels = cellstr (labels); - endif - if (isnumeric (labels)) - labels = num2str (real (labels(:))); - endif - if (ischar (labels)) - labels = permute (cellstr (labels), [2, 1]); - endif - if (iscellstr (labels)) - k = 1; - ntics = numel (tics); - nlabels = numel (labels); - fprintf (plot_stream, "set %stics add %s %s %s %s (", ax, - tickdir, ticklength, axispos, mirror); - labels = strrep (labels, "%", "%%"); - for i = 1:ntics - fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i)); - if (i < ntics) - fputs (plot_stream, ", "); - endif - if (k > nlabels) - k = 1; - endif - endfor - fprintf (plot_stream, ") %s %s;\n", colorspec, fontspec); - else - error ("__go_draw_axes__: unsupported type of ticklabel"); - endif + k = 1; + ntics = numel (tics); + nlabels = numel (labels); + fprintf (plot_stream, "set %stics add %s %s %s %s (", ax, + tickdir, ticklength, axispos, mirror); + labels = strrep (labels, "%", "%%"); + for i = 1:ntics + fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i)); + if (i < ntics) + fputs (plot_stream, ", "); + endif + if (k > nlabels) + k = 1; + endif + endfor + fprintf (plot_stream, ") %s %s;\n", colorspec, fontspec); endif else fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt); @@ -2201,20 +2188,12 @@ endfunction function ticklabel = ticklabel_to_cell (ticklabel) - if (isnumeric (ticklabel)) - ## Use upto 5 significant digits - ticklabel = num2str (ticklabel(:), 5); - endif if (ischar (ticklabel)) - if (rows (ticklabel) == 1 && any (ticklabel == "|")) - ticklabel = ostrsplit (ticklabel, "|"); - else - ticklabel = cellstr (ticklabel); - endif - elseif (isempty (ticklabel)) - ticklabel = {""}; + ticklabel = cellstr (ticklabel); + elseif (iscellstr (ticklabel)) + ticklabel = ticklabel; else - ticklabel = ticklabel; + error ("__go_draw_axes__: unsupported type of ticklabel"); endif endfunction