# HG changeset patch # User Ben Abbott # Date 1297381716 18000 # Node ID a754c2d8a13fa8b59db4ef4a062daa9bf6aae5fd # Parent 0f21f258aa177a225e29ec12097931ffa7c1fa1d Modify demo scripts to allow conventient conversion to Matlab compatible syntax. diff -r 0f21f258aa17 -r a754c2d8a13f scripts/ChangeLog --- a/scripts/ChangeLog Thu Feb 10 16:24:15 2011 -0500 +++ b/scripts/ChangeLog Thu Feb 10 18:48:36 2011 -0500 @@ -1,3 +1,9 @@ +2011-02-10 Ben Abbott + + * 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 * plot/__go_draw_axes__.m: Properly set fontspec for legends. diff -r 0f21f258aa17 -r a754c2d8a13f scripts/plot/legend.m --- a/scripts/plot/legend.m Thu Feb 10 16:24:15 2011 -0500 +++ b/scripts/plot/legend.m Thu Feb 10 18:48:36 2011 -0500 @@ -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; diff -r 0f21f258aa17 -r a754c2d8a13f scripts/plot/plotyy.m --- a/scripts/plot/plotyy.m Thu Feb 10 16:24:15 2011 -0500 +++ b/scripts/plot/plotyy.m Thu Feb 10 18:48:36 2011 -0500 @@ -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 diff -r 0f21f258aa17 -r a754c2d8a13f scripts/plot/shading.m --- a/scripts/plot/shading.m Thu Feb 10 16:24:15 2011 -0500 +++ b/scripts/plot/shading.m Thu Feb 10 18:48:36 2011 -0500 @@ -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""") diff -r 0f21f258aa17 -r a754c2d8a13f scripts/plot/sombrero.m --- a/scripts/plot/sombrero.m Thu Feb 10 16:24:15 2011 -0500 +++ b/scripts/plot/sombrero.m Thu Feb 10 18:48:36 2011 -0500 @@ -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; diff -r 0f21f258aa17 -r a754c2d8a13f scripts/plot/text.m --- a/scripts/plot/text.m Thu Feb 10 16:24:15 2011 -0500 +++ b/scripts/plot/text.m Thu Feb 10 18:48:36 2011 -0500 @@ -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])