# HG changeset patch # User Ben Abbott # Date 1243494641 14400 # Node ID 40fb718a2e6753a30f93f2af9a5c8ff55c5b4ecd # Parent 1673a0dc019f9889e3cf76dd58527dcec4059b5e __go_draw_axes__.m: Add support for ticklabel separator '|'. diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-05-28 Ben Abbott + + * plot/__go_draw_axes__.m: Add support for ticklabel separator '|'. + 2009-05-28 Jaroslav Hajek * sparse/bicgstab.m: Improve preconditioning; avoid explicit inverse. 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 @@ -1685,13 +1685,34 @@ endif endfunction -function ticklabel = ticklabel_to_cell (ticklabel) +function newlabel = 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); + n = setdiff (findstr (ticklabel, '|'), findstr (ticklabel, '\|')); + if (! isempty (n)) + ## FIXME - Can regexp() do this easier? + if (ticklabel(1) != "|") + n = unique ([n, 0]); + endif + if (ticklabel(end) != "|") + n = unique ([n, numel(ticklabel)+1]); + endif + n1 = n + 1; + n1 = n1(n10) + newlabel = cell (numel(n2), 1); + for n = 1:numel(newlabel) + newlabel{n} = ticklabel(n1(n):n2(n)); + endfor + else + newlabel = cellstr (ticklabel); + endif + else + newlabel = ticklabel; endif endfunction