Mercurial > hg > octave-nkf
diff scripts/plot/text.m @ 14245:4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
* contrast.m, axis.m, clabel.m, colorbar.m, comet.m, contour.m, contour3.m,
cylinder.m, daspect.m, errorbar.m, ezplot.m, fplot.m, grid.m, hold.m,
isosurface.m, legend.m, loglog.m, loglogerr.m, pareto.m, patch.m, pbaspect.m,
pie.m, pie3.m, plot3.m, plotmatrix.m, plotyy.m, quiver.m, quiver3.m,
rectangle.m, refreshdata.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m,
semilogy.m, semilogyerr.m, shading.m, stem.m, subplot.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: Use Matlab coding conventions
for demos so that compare plots scripts will function.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 22 Jan 2012 07:31:32 -0800 |
parents | 11949c9795a0 |
children | 27abe77158d6 |
line wrap: on
line diff
--- a/scripts/plot/text.m +++ b/scripts/plot/text.m @@ -129,94 +129,94 @@ %!demo %! clf; -%! ha = {"left", "center", "right"}; -%! va = {"bottom", "middle", "top"}; +%! ha = {'left', 'center', 'right'}; +%! va = {'bottom', 'middle', 'top'}; %! x = y = [0.25 0.5 0.75]; %! for t = 0:30:359; %! for nh = 1:numel(ha) %! for nv = 1:numel(va) -%! text (x(nh), y(nv), "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); +%! text (x(nh), y(nv), 'Hello World', ... +%! 'rotation', t, ... +%! 'horizontalalignment', ha{nh}, ... +%! 'verticalalignment', va{nv}); +%! end +%! end +%! end +%! 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)"); +%! xlabel ('horizontal alignment'); +%! ylabel ('vertical alignment'); +%! title ('text alignment and rotation (0:30:360 degrees)'); %!demo %! clf; -%! h = mesh (peaks, "edgecolor", 0.7 * [1 1 1], ... -%! "facecolor", "none", ... -%! "facealpha", 0); +%! h = mesh (peaks, 'edgecolor', 0.7 * [1 1 1], ... +%! 'facecolor', 'none', ... +%! 'facealpha', 0); %! for t = 0:45:359; -%! text (25, 25, 0, "Vertical Alignment = Bottom", ... -%! "rotation", t, ... -%! "horizontalalignment", "left", ... -%! "verticalalignment", "bottom"); -%! endfor +%! text (25, 25, 0, 'Vertical Alignment = Bottom', ... +%! 'rotation', t, ... +%! 'horizontalalignment', 'left', ... +%! 'verticalalignment', 'bottom'); +%! end %! caxis ([-100 100]); -%! title ("Vertically Aligned at Bottom"); +%! title ('Vertically Aligned at Bottom'); %!demo %! clf; %! axis ([0 8 0 8]); -%! title (["1st title";"2nd title"]); -%! xlabel (["1st xlabel";"2nd xlabel"]); -%! ylabel (["1st ylabel";"2nd ylabel"]); -%! text (4, 4, {"Hello", "World"}, ... -%! "horizontalalignment", "center", ... -%! "verticalalignment", "middle"); +%! title (['1st title';'2nd title']); +%! xlabel (['1st xlabel';'2nd xlabel']); +%! ylabel (['1st ylabel';'2nd ylabel']); +%! text (4, 4, {'Hello', 'World'}, ... +%! 'horizontalalignment', 'center', ... +%! 'verticalalignment', 'middle'); %! grid on; %!demo %! clf; -%! h = mesh (peaks (), "edgecolor", 0.7 * [1 1 1], ... -%! "facecolor", "none", ... -%! "facealpha", 0); -%! title (["1st title";"2nd title"]); -%! xlabel (["1st xlabel";"2nd xlabel"]); -%! ylabel (["1st ylabel";"2nd ylabel"]); -%! zlabel (["1st zlabel";"2nd zlabel"]); -%! text (0, 0, 5, {"Hello", "World"}, ... -%! "horizontalalignment", "center", ... -%! "verticalalignment", "middle"); +%! h = mesh (peaks (), 'edgecolor', 0.7 * [1 1 1], ... +%! 'facecolor', 'none', ... +%! 'facealpha', 0); +%! title (['1st title';'2nd title']); +%! xlabel (['1st xlabel';'2nd xlabel']); +%! ylabel (['1st ylabel';'2nd ylabel']); +%! zlabel (['1st zlabel';'2nd zlabel']); +%! text (0, 0, 5, {'Hello', 'World'}, ... +%! 'horizontalalignment', 'center', ... +%! 'verticalalignment', 'middle'); %! hold on; -%! plot3 (0, 0, 5, "+k"); +%! plot3 (0, 0, 5, '+k'); %!demo %! clf; -%! h = text (0.5, 0.3, "char"); -%! assert ("char", class (get (h, "string"))); -%! h = text (0.5, 0.4, ["char row 1"; "char row 2"]); -%! assert ("char", class (get (h, "string"))); -%! h = text (0.5, 0.6, {"cell2str (1,1)", "cell2str (1,2)"; "cell2str (2,1)", "cell2str (2,2)"}); -%! assert ("cell", class (get (h, "string"))); -%! h = text (0.5, 0.8, "foobar"); -%! set (h, "string", 1:3); -%! h = text ([0.1, 0.1], [0.3, 0.4], "one string & two objects"); -%! assert ("char", class (get (h(1), "string"))); -%! assert ("char", class (get (h(2), "string"))); -%! h = text ([0.1, 0.1], [0.5, 0.6], {"one cellstr & two objects"}); -%! assert ("cell", class (get (h(1), "string"))); -%! assert ("cell", class (get (h(2), "string"))); -%! h = text ([0.1, 0.1], [0.7, 0.8], {"cellstr 1 object 1", "cellstr 2 object 2"}); -%! assert ("char", class (get (h(1), "string"))); -%! assert ("char", class (get (h(2), "string"))); -%! h = text ([0.1, 0.1], [0.1, 0.2], ["1st string & 1st object"; "2nd string & 2nd object"]); -%! assert ("char", class (get (h(1), "string"))); -%! assert ("char", class (get (h(2), "string"))); -%! h = text (0.7, 0.6, "single string"); -%! assert ("char", class (get (h, "string"))); -%! h = text (0.7, 0.5, {"single cell-string"}); -%! assert ("cell", class (get (h, "string"))); +%! h = text (0.5, 0.3, 'char'); +%! assert ('char', class (get (h, 'string'))); +%! h = text (0.5, 0.4, ['char row 1'; 'char row 2']); +%! assert ('char', class (get (h, 'string'))); +%! h = text (0.5, 0.6, {'cell2str (1,1)', 'cell2str (1,2)'; 'cell2str (2,1)', 'cell2str (2,2)'}); +%! assert ('cell', class (get (h, 'string'))); +%! h = text (0.5, 0.8, 'foobar'); +%! set (h, 'string', 1:3); +%! h = text ([0.1, 0.1], [0.3, 0.4], 'one string & two objects'); +%! assert ('char', class (get (h(1), 'string'))); +%! assert ('char', class (get (h(2), 'string'))); +%! h = text ([0.1, 0.1], [0.5, 0.6], {'one cellstr & two objects'}); +%! assert ('cell', class (get (h(1), 'string'))); +%! assert ('cell', class (get (h(2), 'string'))); +%! h = text ([0.1, 0.1], [0.7, 0.8], {'cellstr 1 object 1', 'cellstr 2 object 2'}); +%! assert ('char', class (get (h(1), 'string'))); +%! assert ('char', class (get (h(2), 'string'))); +%! h = text ([0.1, 0.1], [0.1, 0.2], ['1st string & 1st object'; '2nd string & 2nd object']); +%! assert ('char', class (get (h(1), 'string'))); +%! assert ('char', class (get (h(2), 'string'))); +%! h = text (0.7, 0.6, 'single string'); +%! assert ('char', class (get (h, 'string'))); +%! h = text (0.7, 0.5, {'single cell-string'}); +%! assert ('cell', class (get (h, 'string'))); %! xlabel (1:2); %! ylabel (1:2); %! title (1:2);