changeset 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 81d6ab3ac93c
children 68aa5abfd136
files scripts/ChangeLog scripts/plot/__go_draw_axes__.m
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Jan 14 20:44:25 2009 -0500
+++ b/scripts/ChangeLog	Wed Jan 14 21:01:19 2009 -0500
@@ -1,3 +1,8 @@
+2009-01-14  Ben Abbott  <bpabbott@mac.com>
+
+	* plot/__go_draw_axes__.m (ticklabel_to_cell): New function.
+	Use it to handle non-cell ticklabels.
+
 2009-01-14  Søren Hauberg  <hauberg@gmail.com>
 
 	* general/diff.m, general/logspace.m, general/nextpow2.m,
--- 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 = "";