From octave-sources-request at bevo dot che dot wisc dot edu Wed Jul 19 18:25:40 2000 Subject: Re: Errorbar update From: pkienzle at kienzle dot powernet dot co dot uk (Paul Kienzle) To: tpikonen at pcu dot helsinki dot fi Cc: octave-sources at bevo dot che dot wisc dot edu Date: Wed, 19 Jul 2000 23:34:25 +0100 (BST) Teemu, Thanks for coding the errorbar() function. I've had a chance to try it out, and found a few issues: 1) Matlab's doc: errorbar(X,Y,L,U) plots X versus Y with error bars L(i)+U(i) long specifying the lower and upper error bars. X, Y, L, and U must be the same size. When they are vectors, each error bar is a distance of L(i) below and U(i) above the point defined by (X(i),Y(i)). When they are matrices, each error bar is a distance of L(i,j) below and U(i,j) above the point defined by (X(i,j),Y(i,j)). Your implementation seems to to want errorbar(x,y,y-l,y+u) instead of errorbar(x,y,l,u). 2) Matlab's doc: errorbar(...,LineSpec) draws the error bars using the line type, marker symbol, and color specified by LineSpec. In particular, Matlab's errorbar(x,y) does the default linespec for plot, which is to draw a line connecting the points, but can be set to any sort of linespec between the points. Gnuplot can only do one thing at a time (errorbar or line), so you will have to do a plot, hold, plot with "w " -> "w e" and "t " -> "notitle". Could be tricky. Particularly confusing is: errorbar(x,y,dy,";;"); which not only supresses the legend entry, but also supresses the error bars themselves, drawing instead a line to connect the x-y's. 3) I'm not sure what the point of "#" style is. bar(x,y) seems to do what you need, except it doesn't handle overlapping boxes. I can understand the need for "#~" (confidence levels on your bar charts), but for the few times that you need them, you can do that with: bar(x,y); hold on; errorbar(x,y,dy,".;;"); hold off; 4) The plot options ~, < and # don't work with the plot() command (obviously), which makes an already confusing command even more confusing. Couldn't you have three different commands for error bars: errorbar(), xerrorbar(), xyerrorbar() This takes care of ~ and <, and you can drop the # option entirely since it is more or less handled by bar(). 5) Even the matrix version works. Wow! A minor problem though: octave:179> errorbar([x x], [y y+2], [dy dy], ["~;y;" ; "~;y+2;"]) error: invalid conversion from string to real matrix error: evaluating index expression near line 76, column 15 error: evaluating assignment expression near line 76, column 13 error: evaluating for command near line 69, column 5 error: evaluating if command near line 62, column 1 error: called from `__errplot' in file ... error: called from `errorbar' in file ... Paul Kienzle pkienzle at kienzle dot powernet dot co dot uk ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------