comparison scripts/plot/text.m @ 14237:11949c9795a0

Revamp %!demos in m-files to use Octave coding conventions on spacing, etc. Add clf() to all demos using plot features to get reproducibility. Use 64 as input to all colormaps (jet (64)) to get reproducibility. * bicubic.m, cell2mat.m, celldisp.m, cplxpair.m, interp1.m, interp2.m, interpft.m, interpn.m, profile.m, profshow.m, convhull.m, delaunay.m, griddata.m, inpolygon.m, voronoi.m, autumn.m, bone.m, contrast.m, cool.m, copper.m, flag.m, gmap40.m, gray.m, hot.m, hsv.m, image.m, imshow.m, jet.m, ocean.m, pink.m, prism.m, rainbow.m, spring.m, summer.m, white.m, winter.m, condest.m, onenormest.m, axis.m, clabel.m, colorbar.m, comet.m, comet3.m, compass.m, contour.m, contour3.m, contourf.m, cylinder.m, daspect.m, ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m, fplot.m, grid.m, hold.m, isosurface.m, legend.m, loglog.m, loglogerr.m, pareto.m, patch.m, pbaspect.m, pcolor.m, pie.m, pie3.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m, rose.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m, shading.m, slice.m, sombrero.m, stairs.m, stem.m, stem3.m, subplot.m, surf.m, surfc.m, surfl.m, surfnorm.m, text.m, title.m, trimesh.m, triplot.m, trisurf.m, uigetdir.m, uigetfile.m, uimenu.m, uiputfile.m, waitbar.m, xlim.m, ylim.m, zlim.m, mkpp.m, pchip.m, polyaffine.m, spline.m, bicgstab.m, cgs.m, gplot.m, pcg.m, pcr.m, treeplot.m, strtok.m, demo.m, example.m, rundemos.m, speed.m, test.m, calendar.m, datestr.m, datetick.m, weekday.m: Revamp %!demos to use Octave coding conventions on spacing, etc.
author Rik <octave@nomad.inbox5.com>
date Fri, 20 Jan 2012 12:59:53 -0800
parents 72c96de7a403
children 4506eade9f04
comparison
equal deleted inserted replaced
14236:35903f035390 14237:11949c9795a0
124 print_usage (); 124 print_usage ();
125 endif 125 endif
126 126
127 endfunction 127 endfunction
128 128
129 %!demo 129
130 %! clf 130 %!demo
131 %! clf;
131 %! ha = {"left", "center", "right"}; 132 %! ha = {"left", "center", "right"};
132 %! va = {"bottom", "middle", "top"}; 133 %! va = {"bottom", "middle", "top"};
133 %! x = [0.25 0.5 0.75]; 134 %! x = y = [0.25 0.5 0.75];
134 %! y = [0.25 0.5 0.75];
135 %! for t = 0:30:359; 135 %! for t = 0:30:359;
136 %! for nh = 1:numel(ha) 136 %! for nh = 1:numel(ha)
137 %! for nv = 1:numel(va) 137 %! for nv = 1:numel(va)
138 %! text (x(nh), y(nv), "Hello World", ... 138 %! text (x(nh), y(nv), "Hello World", ...
139 %! "rotation", t, ... 139 %! "rotation", t, ...
147 %! "ytick", [0.25, 0.5, 0.75], ... 147 %! "ytick", [0.25, 0.5, 0.75], ...
148 %! "yticklabel", va); 148 %! "yticklabel", va);
149 %! axis ([0 1 0 1]); 149 %! axis ([0 1 0 1]);
150 %! xlabel ("horizontal alignment"); 150 %! xlabel ("horizontal alignment");
151 %! ylabel ("vertical alignment"); 151 %! ylabel ("vertical alignment");
152 %! title ("text alignment and rotation (0:30:360 degrees)") 152 %! title ("text alignment and rotation (0:30:360 degrees)");
153 153
154 %!demo 154 %!demo
155 %! clf 155 %! clf;
156 %! h = mesh (peaks, "edgecolor", 0.7 * [1 1 1], ... 156 %! h = mesh (peaks, "edgecolor", 0.7 * [1 1 1], ...
157 %! "facecolor", "none", ... 157 %! "facecolor", "none", ...
158 %! "facealpha", 0); 158 %! "facealpha", 0);
159 %! for t = 0:45:359; 159 %! for t = 0:45:359;
160 %! text (25, 25, 0, "Vertical Alignment = Bottom", ... 160 %! text (25, 25, 0, "Vertical Alignment = Bottom", ...
164 %! endfor 164 %! endfor
165 %! caxis ([-100 100]); 165 %! caxis ([-100 100]);
166 %! title ("Vertically Aligned at Bottom"); 166 %! title ("Vertically Aligned at Bottom");
167 167
168 %!demo 168 %!demo
169 %! clf 169 %! clf;
170 %! axis ([0 8 0 8]); 170 %! axis ([0 8 0 8]);
171 %! title (["1st title";"2nd title"]); 171 %! title (["1st title";"2nd title"]);
172 %! xlabel (["1st xlabel";"2nd xlabel"]); 172 %! xlabel (["1st xlabel";"2nd xlabel"]);
173 %! ylabel (["1st ylabel";"2nd ylabel"]); 173 %! ylabel (["1st ylabel";"2nd ylabel"]);
174 %! text (4, 4, {"Hello", "World"}, ... 174 %! text (4, 4, {"Hello", "World"}, ...
175 %! "horizontalalignment", "center", ... 175 %! "horizontalalignment", "center", ...
176 %! "verticalalignment", "middle"); 176 %! "verticalalignment", "middle");
177 %! grid on 177 %! grid on;
178 178
179 %!demo 179 %!demo
180 %! clf 180 %! clf;
181 %! h = mesh (peaks, "edgecolor", 0.7 * [1 1 1], ... 181 %! h = mesh (peaks (), "edgecolor", 0.7 * [1 1 1], ...
182 %! "facecolor", "none", ... 182 %! "facecolor", "none", ...
183 %! "facealpha", 0); 183 %! "facealpha", 0);
184 %! title (["1st title";"2nd title"]); 184 %! title (["1st title";"2nd title"]);
185 %! xlabel (["1st xlabel";"2nd xlabel"]); 185 %! xlabel (["1st xlabel";"2nd xlabel"]);
186 %! ylabel (["1st ylabel";"2nd ylabel"]); 186 %! ylabel (["1st ylabel";"2nd ylabel"]);
187 %! zlabel (["1st zlabel";"2nd zlabel"]); 187 %! zlabel (["1st zlabel";"2nd zlabel"]);
188 %! text (0, 0, 5, {"Hello", "World"}, ... 188 %! text (0, 0, 5, {"Hello", "World"}, ...
190 %! "verticalalignment", "middle"); 190 %! "verticalalignment", "middle");
191 %! hold on; 191 %! hold on;
192 %! plot3 (0, 0, 5, "+k"); 192 %! plot3 (0, 0, 5, "+k");
193 193
194 %!demo 194 %!demo
195 %! clf 195 %! clf;
196 %! h = text (0.5, 0.3, "char"); 196 %! h = text (0.5, 0.3, "char");
197 %! assert ("char", class (get (h, "string"))); 197 %! assert ("char", class (get (h, "string")));
198 %! h = text (0.5, 0.4, ["char row 1"; "char row 2"]); 198 %! h = text (0.5, 0.4, ["char row 1"; "char row 2"]);
199 %! assert ("char", class (get (h, "string"))); 199 %! assert ("char", class (get (h, "string")));
200 %! h = text (0.5, 0.6, {"cell2str (1,1)", "cell2str (1,2)"; "cell2str (2,1)", "cell2str (2,2)"}); 200 %! h = text (0.5, 0.6, {"cell2str (1,1)", "cell2str (1,2)"; "cell2str (2,1)", "cell2str (2,2)"});