# HG changeset patch # User Ben Abbott # Date 1231984879 18000 # Node ID c2c018d7c5018b86029e104a303f0600118aead4 # Parent 81d6ab3ac93ccf719684db4b22c93a9f5626c48f __go_draw_axes__.m: __go_draw_axes__.m: Support non-cell ticklabels. diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2009-01-14 Ben Abbott + + * plot/__go_draw_axes__.m (ticklabel_to_cell): New function. + Use it to handle non-cell ticklabels. + 2009-01-14 Søren Hauberg * general/diff.m, general/logspace.m, general/nextpow2.m, diff --git a/scripts/plot/__go_draw_axes__.m b/scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -1378,6 +1378,10 @@ function do_tics (obj, plot_stream, ymirror, mono) + obj.xticklabel = ticklabel_to_cell (obj.xticklabel); + obj.yticklabel = ticklabel_to_cell (obj.yticklabel); + obj.zticklabel = ticklabel_to_cell (obj.zticklabel); + [fontname, fontsize] = get_fontname_and_size (obj); if (strcmpi (obj.xaxislocation, "top")) @@ -1528,6 +1532,16 @@ endif endfunction +function ticklabel = ticklabel_to_cell (ticklabel) + if (! isempty (ticklabel) && ! iscell (ticklabel)) + if (isnumeric (ticklabel)) + ## Use upto 5 significant digits + ticklabel = num2str (ticklabel(:), 5); + endif + ticklabel = cellstr (ticklabel); + endif +endfunction + function colorspec = get_text_colorspec (color, mono) if (mono) colorspec = "";