Mercurial > hg > octave-shane
changeset 11416:74e285bb61c9
text.m: Add demo for text rotation and alignment.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Mon, 27 Dec 2010 11:13:06 -0500 |
parents | e7ed20f87e82 |
children | 1a7b41db5432 |
files | scripts/ChangeLog scripts/plot/text.m |
diffstat | 2 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-12-27 Ben Abbott <bpabbott@mac.com> + + * plot/text.m: Add demo for text rotation and alignment. + 2010-12-26 Michael Godfrey <godfrey@isl.stanford.edu> * specfun/legendre.m: Add @tex blocks to docstring.
--- a/scripts/plot/text.m +++ b/scripts/plot/text.m @@ -103,3 +103,28 @@ endif endfunction + +%!demo +%! clf +%! ha = {"left", "center", "right"}; +%! va = {"bottom", "middle", "top"}; +%! for t = 0:30:359; +%! for nh = 1:numel(ha) +%! x = [0.25 0.5 0.75](nh); +%! for nv = 1:numel(va) +%! y = [0.25 0.5 0.75](nv); +%! text (x, y, "Hello World", +%! "rotation", t, +%! "horizontalalignment", ha{nh}, +%! "verticalalignment", va{nv}) +%! endfor +%! endfor +%! endfor +%! set (gca, "xtick", [0.25, 0.5, 0.75], +%! "xticklabel", ha, +%! "ytick", [0.25, 0.5, 0.75], +%! "yticklabel", va) +%! axis ([0 1 0 1]) +%! xlabel ("horizontal alignment") +%! ylabel ("vertical alignment") +%! title ("text alignment and rotation (0:30:360 degrees)")