Mercurial > hg > octave-lojdl
changeset 8315:e9687c313d5f
Fix callbacks in stem and quiver for change in order of children. Fix for scaling in quiver for single arrow
author | David Bateman <dbateman@free.fr> |
---|---|
date | Wed, 12 Nov 2008 12:21:04 +0100 |
parents | eb0fb4a9859c |
children | 830ad84d2654 |
files | scripts/ChangeLog scripts/plot/__quiver__.m scripts/plot/__stem__.m |
diffstat | 3 files changed, 26 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -3,6 +3,12 @@ * polynomial/spline.m: Delete debugging statements. From Sebastian Schöps <sebastian@schoeps.org>. +2008-11-12 David Bateman <dbateman@free.fr> + + * 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 <highegg@gmail.com> * optimization/__fdjac__.m: New function file.
--- a/scripts/plot/__quiver__.m +++ b/scripts/plot/__quiver__.m @@ -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"));
--- a/scripts/plot/__stem__.m +++ b/scripts/plot/__stem__.m @@ -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