Mercurial > hg > octave-lojdl
changeset 12437:a754c2d8a13f
Modify demo scripts to allow conventient conversion to Matlab compatible syntax.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Thu, 10 Feb 2011 18:48:36 -0500 |
parents | 0f21f258aa17 |
children | ab4c6bbff14a |
files | scripts/ChangeLog scripts/plot/legend.m scripts/plot/plotyy.m scripts/plot/shading.m scripts/plot/sombrero.m scripts/plot/text.m |
diffstat | 6 files changed, 32 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,9 @@ +2011-02-10 Ben Abbott <bpabbott@mac.com> + + * plot/legend.m, plot/plotyy.m, plot/sombrero.m, plot/shading.m, + plot/text.m: Modify demo scripts to allow conventient conversion + to Matlab compatible syntax. + 2011-02-08 Ben Abbott <bpabbott@mac.com> * plot/__go_draw_axes__.m: Properly set fontspec for legends.
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -1041,9 +1041,10 @@ %!demo %! clf %! labels = {}; +%! colororder = get (gca, "colororder"); %! for i = 1:5 %! h = plot(1:100, i + rand(100,1)); hold on; -%! set (h, "color", get (gca, "colororder")(i,:)) +%! set (h, "color", colororder(i,:)) %! labels = {labels{:}, cstrcat("Signal ", num2str(i))}; %! endfor %! hold off; @@ -1055,9 +1056,10 @@ %!demo %! clf %! labels = {}; +%! colororder = get (gca, "colororder"); %! for i = 1:5 %! h = plot(1:100, i + rand(100,1)); hold on; -%! set (h, "color", get (gca, "colororder")(i,:)) +%! set (h, "color", colororder(i,:)) %! labels = {labels{:}, cstrcat("Signal ", num2str(i))}; %! endfor %! hold off;
--- a/scripts/plot/plotyy.m +++ b/scripts/plot/plotyy.m @@ -222,10 +222,10 @@ %! ylabel (ax(1), "Axis 1"); %! ylabel (ax(2), "Axis 2"); %! axes (ax(1)) -%! text (0.5, 0.5, "Left Axis", +%! text (0.5, 0.5, "Left Axis", ... %! "color", [0 0 1], "horizontalalignment", "center") %! axes (ax(2)) -%! text (4.5, 80, "Right Axis", +%! text (4.5, 80, "Right Axis", ... %! "color", [0 0.5 0], "horizontalalignment", "center") %!demo
--- a/scripts/plot/shading.m +++ b/scripts/plot/shading.m @@ -78,19 +78,19 @@ %! colormap (jet) %! sombrero %! shading faceted -%! title('shading "faceted"') +%! title("shading ""faceted""") %!demo %! sombrero %! shading interp -%! title('shading "interp"') +%! title("shading ""interp""") %!demo %! pcolor (peaks ()) %! shading faceted -%! title('shading "faceted"') +%! title("shading ""faceted""") %!demo %! pcolor (peaks ()) %! shading interp -%! title('shading "interp"') +%! title("shading ""interp""")
--- a/scripts/plot/sombrero.m +++ b/scripts/plot/sombrero.m @@ -39,7 +39,8 @@ if (nargin < 2) if (n > 1) - tx = ty = linspace (-8, 8, n)'; + tx = linspace (-8, 8, n)'; + ty = tx; [xx, yy] = meshgrid (tx, ty); r = sqrt (xx .^ 2 + yy .^ 2) + eps; tz = sin (r) ./ r;
--- a/scripts/plot/text.m +++ b/scripts/plot/text.m @@ -108,21 +108,21 @@ %! clf %! ha = {"left", "center", "right"}; %! va = {"bottom", "middle", "top"}; +%! x = [0.25 0.5 0.75]; +%! y = [0.25 0.5 0.75]; %! 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}) +%! 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], +%! 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") @@ -131,13 +131,13 @@ %!demo %! clf -%! h = mesh (peaks, "edgecolor", 0.7 * [1 1 1], -%! "facecolor", "none", +%! 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", +%! text (25, 25, 0, "Vertical Alignment = Bottom", ... +%! "rotation", t, ... +%! "horizontalalignment", "left", ... %! "verticalalignment", "bottom") %! endfor %! caxis ([-100 100])