# HG changeset patch # User David Bateman # Date 1226488864 -3600 # Node ID e9687c313d5fd80378ffc456c8e3f55b9e5608ab # Parent eb0fb4a9859cf2b7676a3a9bb4de9d14e1b7ea58 Fix callbacks in stem and quiver for change in order of children. Fix for scaling in quiver for single arrow diff -r eb0fb4a9859c -r e9687c313d5f scripts/ChangeLog --- a/scripts/ChangeLog Wed Nov 12 10:24:14 2008 +0100 +++ b/scripts/ChangeLog Wed Nov 12 12:21:04 2008 +0100 @@ -3,6 +3,12 @@ * polynomial/spline.m: Delete debugging statements. From Sebastian Schöps . +2008-11-12 David Bateman + + * plot/__quiver__.m: Only autoscale if more than one element to + plot. Modify callbacks for change in order of children. + * plot/__stem__.m: Modify callbacks for change in order of children. + 2008-09-28 Jaroslav Hajek * optimization/__fdjac__.m: New function file. diff -r eb0fb4a9859c -r e9687c313d5f scripts/plot/__quiver__.m --- a/scripts/plot/__quiver__.m Wed Nov 12 10:24:14 2008 +0100 +++ b/scripts/plot/__quiver__.m Wed Nov 12 12:21:04 2008 +0100 @@ -102,7 +102,7 @@ endif endwhile - if (autoscale) + if (autoscale && numel (u) > 1) ## Scale the arrows to fit in the grid dx = (max(x(:)) - min(x(:))) ./ size (x, 2); dy = (max(y(:)) - min(y(:))) ./ size (y, 1); @@ -122,6 +122,12 @@ ww = s*w; endif endif + else + uu = u; + vv = v; + if (is3d) + ww = w; + endif endif hstate = get (h, "nextplot"); @@ -355,10 +361,10 @@ zend = z + w(:); endif - set (kids (1), "xdata", [x.'; xend.'; NaN(1, length (x))](:)); - set (kids (1), "ydata", [y.'; yend.'; NaN(1, length (y))](:)); + set (kids (3), "xdata", [x.'; xend.'; NaN(1, length (x))](:)); + set (kids (3), "ydata", [y.'; yend.'; NaN(1, length (y))](:)); if (is3d) - set (kids (1), "zdata", [z.'; zend.'; NaN(1, length (z))](:)); + set (kids (3), "zdata", [z.'; zend.'; NaN(1, length (z))](:)); endif xtmp = x + u(:) .* (1 - arrowsize); @@ -383,10 +389,10 @@ set (kids (2), "zdata", [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:)); endif - set (kids (3), "xdata", x); - set (kids (3), "ydata", y); + set (kids (1), "xdata", x); + set (kids (1), "ydata", y); if (is3d) - set (kids (3), "zdata", z); + set (kids (1), "zdata", z); endif endfunction @@ -394,7 +400,7 @@ function update_props (h, d) kids = get (h, "children"); - set (kids(1), "color", get (h, "color"), + set (kids(3), "color", get (h, "color"), "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle")); set (kids(2), "color", get (h, "color"), @@ -405,7 +411,7 @@ else set (kids (2), "visible", "off"); endif - set (kids(3), "color", get (h, "color"), + set (kids(1), "color", get (h, "color"), "marker", get (h, "marker"), "markerfacecolor", get (h, "markerfacecolor"), "markersize", get (h, "markersize")); diff -r eb0fb4a9859c -r e9687c313d5f scripts/plot/__stem__.m --- a/scripts/plot/__stem__.m Wed Nov 12 10:24:14 2008 +0100 +++ b/scripts/plot/__stem__.m Wed Nov 12 12:21:04 2008 +0100 @@ -497,15 +497,15 @@ yt = get(h, "ydata")(:)'; ny = length (yt); yt = [b0 * ones(1, ny); yt; NaN(1, ny)](:); - set (kids(end), "ydata", yt); + set (kids(2), "ydata", yt); endfunction function update_props (h, d) kids = get (h, "children"); - set (kids(1), "color", get (h, "color"), + set (kids(2), "color", get (h, "color"), "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle")); - set (kids(2), "color", get (h, "color"), + set (kids(1), "color", get (h, "color"), "marker", get (h, "marker"), "markerfacecolor", get (h, "markerfacecolor"), "markersize", get (h, "markersize")); @@ -537,7 +537,7 @@ endif kids = get (h, "children"); - set (kids(1), "xdata", xt, "ydata", yt, "zdata", zt) - set (kids(2), "xdata", x, "ydata", y, "zdata", z) + set (kids(2), "xdata", xt, "ydata", yt, "zdata", zt) + set (kids(1), "xdata", x, "ydata", y, "zdata", z) endif endfunction