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	Sun Dec 26 21:28:20 2010 -0800
+++ b/scripts/ChangeLog	Mon Dec 27 11:13:06 2010 -0500
@@ -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	Sun Dec 26 21:28:20 2010 -0800
+++ b/scripts/plot/text.m	Mon Dec 27 11:13:06 2010 -0500
@@ -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)")