Mercurial > hg > octave-nkf
changeset 9280:40fb718a2e67
__go_draw_axes__.m: Add support for ticklabel separator '|'.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Thu, 28 May 2009 03:10:41 -0400 |
parents | 1673a0dc019f |
children | 02b16eeb3167 |
files | scripts/ChangeLog scripts/plot/__go_draw_axes__.m |
diffstat | 2 files changed, 27 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-05-28 Ben Abbott <bpabbott@mac.com> + + * plot/__go_draw_axes__.m: Add support for ticklabel separator '|'. + 2009-05-28 Jaroslav Hajek <highegg@gmail.com> * sparse/bicgstab.m: Improve preconditioning; avoid explicit inverse.
--- 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(n1<numel(ticklabel)) + n2 = n - 1; + n2 = n2(n2>0) + 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