Mercurial > hg > octave-avbm
changeset 10573:d8894a2d0a03
Allow x, xy and box errorbars with different plotting syntax
author | David Bateman <dbateman@free.fr> |
---|---|
date | Mon, 26 Apr 2010 14:33:54 +0200 |
parents | 148559d9d4ac |
children | 43685a0541c4 |
files | scripts/ChangeLog scripts/plot/private/__errplot__.m |
diffstat | 2 files changed, 34 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -3,6 +3,9 @@ * plot/bar.m: Document the use of the colormap for the color of the bars. + * plot/private/__errplot__.m: Allow x, box and xy errorbars with + different syntax. + 2010-04-24 David Bateman <dbateman@free.fr> * plot/private/__patch__.m: Correct order of calling setdata and
--- a/scripts/plot/private/__errplot__.m +++ b/scripts/plot/private/__errplot__.m @@ -79,40 +79,46 @@ case 1 error ("error plot requires 2, 3, 4 or 6 columns"); case 2 - set (hl, "xdata", (1:len)'); - set (hl, "ydata", a1(:,i)); - set (hl, "ldata", a2(:,i)); - set (hl, "udata", a2(:,i)); + if (index (ifmt, "xerr")) + set (hl, "xdata", (1:len)', "ydata", a1(:,i), "xldata", a2(:,i), + "xudata", a2(:,i)); + elseif (index (ifmt, "yerr")) + set (hl, "xdata", (1:len)', "ydata", a1(:,i), "ldata", a2(:,i), + "udata", a2(:,i)); + else + error ("2 column errorplot is only valid or xerr or yerr"); + endif case 3 - set (hl, "xdata", a1(:,i)); - set (hl, "ydata", a2(:,i)); - set (hl, "ldata", a3(:,i)); - set (hl, "udata", a3(:,i)); + if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) + set (hl, "xdata", (1:len)', "ydata", a1(:,i), "xldata", a2(:,i), + "xudata", a2(:,i), "ldata", a3(:,i), "udata", a3(:,i)); + elseif (index (ifmt, "xerr")) + set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "xldata", a3(:,i), + "xudata", a3(:,i)); + else + set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "ldata", a3(:,i), + "udata", a3(:,i)); + endif case 4 - set (hl, "xdata", a1(:,i)); - set (hl, "ydata", a2(:,i)); - if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) - set (hl, "xldata", a3(:,i)); - set (hl, "xudata", a3(:,i)); - set (hl, "ldata", a4(:,i)); - set (hl, "udata", a4(:,i)); + set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "xldata", a3(:,i), + "xudata", a3(:,i), "ldata", a4(:,i), "udata", a4(:,i)); elseif (index (ifmt, "xerr")) - set (hl, "xldata", a3(:,i)); - set (hl, "xudata", a4(:,i)); + set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "xldata", a3(:,i), + "xudata", a4(:,i)); else - set (hl, "ldata", a3(:,i)); - set (hl, "udata", a4(:,i)); + set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "ldata", a3(:,i), + "udata", a4(:,i)); endif case 5 error ("error plot requires 2, 3, 4 or 6 columns"); case 6 - set (hl, "xdata", a1(:,i)); - set (hl, "ydata", a2(:,i)); - set (hl, "xldata", a3(:,i)); - set (hl, "xudata", a4(:,i)); - set (hl, "ldata", a5(:,i)); - set (hl, "udata", a6(:,i)); + if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) + set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "xldata", a3(:,i), + "xudata", a4(:,i), "ldata", a5(:,i), "udata", a6(:,i)); + else + error ("error plot with 6 columns only valid for boxxy and xyerr"); + endif endswitch addproperty ("color", hg, "linecolor", get (hl, "color"));