# HG changeset patch # User David Bateman # Date 1272285234 -7200 # Node ID d8894a2d0a030687efdd688421ab40103d0de7df # Parent 148559d9d4aca11aef05b4ed65753f6a2ec2f4d9 Allow x, xy and box errorbars with different plotting syntax diff -r 148559d9d4ac -r d8894a2d0a03 scripts/ChangeLog --- a/scripts/ChangeLog Mon Apr 26 13:27:13 2010 +0200 +++ b/scripts/ChangeLog Mon Apr 26 14:33:54 2010 +0200 @@ -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 * plot/private/__patch__.m: Correct order of calling setdata and diff -r 148559d9d4ac -r d8894a2d0a03 scripts/plot/private/__errplot__.m --- a/scripts/plot/private/__errplot__.m Mon Apr 26 13:27:13 2010 +0200 +++ b/scripts/plot/private/__errplot__.m Mon Apr 26 14:33:54 2010 +0200 @@ -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"));