# HG changeset patch # User Stefan Mahr # Date 1393723792 -3600 # Node ID 6a8cd989c69a21524ebfc9cb6603e945a891c5f3 # Parent d368575195d4a98e25f266a50da49f24f971e65d 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. diff -r d368575195d4 -r 6a8cd989c69a scripts/plot/util/private/__go_draw_axes__.m --- a/scripts/plot/util/private/__go_draw_axes__.m Wed Apr 09 10:23:11 2014 +0200 +++ b/scripts/plot/util/private/__go_draw_axes__.m Sun Mar 02 02:29:52 2014 +0100 @@ -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