diff scripts/plot/__go_draw_axes__.m @ 8518:c2c018d7c501

__go_draw_axes__.m: __go_draw_axes__.m: Support non-cell ticklabels.
author Ben Abbott <bpabbott@mac.com>
date Wed, 14 Jan 2009 21:01:19 -0500
parents 738cb6271933
children 0c5541c39a42
line wrap: on
line diff
--- a/scripts/plot/__go_draw_axes__.m	Wed Jan 14 20:44:25 2009 -0500
+++ b/scripts/plot/__go_draw_axes__.m	Wed Jan 14 21:01:19 2009 -0500
@@ -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 = "";