Mercurial > hg > octave-lyh
comparison 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 |
comparison
equal
deleted
inserted
replaced
11415:e7ed20f87e82 | 11416:74e285bb61c9 |
---|---|
101 else | 101 else |
102 print_usage (); | 102 print_usage (); |
103 endif | 103 endif |
104 | 104 |
105 endfunction | 105 endfunction |
106 | |
107 %!demo | |
108 %! clf | |
109 %! ha = {"left", "center", "right"}; | |
110 %! va = {"bottom", "middle", "top"}; | |
111 %! for t = 0:30:359; | |
112 %! for nh = 1:numel(ha) | |
113 %! x = [0.25 0.5 0.75](nh); | |
114 %! for nv = 1:numel(va) | |
115 %! y = [0.25 0.5 0.75](nv); | |
116 %! text (x, y, "Hello World", | |
117 %! "rotation", t, | |
118 %! "horizontalalignment", ha{nh}, | |
119 %! "verticalalignment", va{nv}) | |
120 %! endfor | |
121 %! endfor | |
122 %! endfor | |
123 %! set (gca, "xtick", [0.25, 0.5, 0.75], | |
124 %! "xticklabel", ha, | |
125 %! "ytick", [0.25, 0.5, 0.75], | |
126 %! "yticklabel", va) | |
127 %! axis ([0 1 0 1]) | |
128 %! xlabel ("horizontal alignment") | |
129 %! ylabel ("vertical alignment") | |
130 %! title ("text alignment and rotation (0:30:360 degrees)") |