diff scripts/plot/text.m @ 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 521f2bb7c443
children bc509d5f763f
line wrap: on
line diff
--- 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)")