Mercurial > hg > octave-lyh
diff scripts/plot/errorbar.m @ 17443:4a6a4657fdf2
Overhaul errorbar family of functions.
* scripts/plot/errorbar.m: Add %!error tests for input validation.
* scripts/plot/private/__errcomm__.m: Correctly validate that numeric inputs
are numeric. More precise error reporting indicating the problematic argument.
* scripts/plot/private/__errplot__.m: Fix automatic color cycling for matrices
with multiple columns of data. Check "yerr" case first in if/elseif trees
since it is the most common. Pull static computations out of for loop for
performance.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 18 Sep 2013 16:54:37 -0700 |
parents | 68bcac3c043a |
children |
line wrap: on
line diff
--- a/scripts/plot/errorbar.m +++ b/scripts/plot/errorbar.m @@ -197,3 +197,24 @@ %! legend ("X-Y errbars", "X-Y errboxes"); %! title ('errorbar() with X-Y errorbars and error boxes'); +## Invisible figure used for tests +%!shared hf, hax +%! hf = figure ("visible", "off"); +%! hax = axes; + +%!error errorbar () +%!error errorbar (1) +%!error <data argument 1 must be numeric> errorbar (hax, {1}, 2) +%!error <data argument 2 must be numeric> errorbar (hax, 1, {2}) +%!error <size of argument 2 does not match others> errorbar (hax, 1, 1:2) +%!error <size of argument 3 does not match others> errorbar (hax, 1, 2, 3:4) +%!error <too many arguments to plot> errorbar (1,2,3,4,5,6,7) + +%!error <2 column errorplot is only valid for xerr> errorbar (1,2, "~>") +%!error <6 columns only valid for xyerr and boxxy> errorbar (1,2,3,4,5,6, "~") +%!error <error plot requires 2, 3, 4, or 6 arguments> errorbar (1,2,3,4,5) + +## Close figure used for testing +%!test +%! close (hf); +