Mercurial > hg > octave-shane
changeset 6512:747ba2dc157e
[project @ 2007-04-10 20:38:57 by jwe]
author | jwe |
---|---|
date | Tue, 10 Apr 2007 20:38:57 +0000 |
parents | 73ce4e14d35d |
children | e0a1dff7677c |
files | scripts/ChangeLog scripts/plot/__go_draw_axes__.m |
diffstat | 2 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2007-04-10 John W. Eaton <jwe@octave.org> + + * plot/__go_draw_axes__.m: Try harder to handle min and max vals + that are close but not exactly equal. + 2007-04-09 Daniel J. Sebald <daniel.sebald@ieee.org> * plot/stem.m: Add back the baseline line and let it be not adjustable
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -707,9 +707,10 @@ endif warning ("axis: omitting negative data in log plot"); endif - if (min_val == max_val) - min_val = 0.9 * min_val; - max_val = 1.1 * max_val; + ## FIXME -- maybe this test should also be relative? + if (abs (min_val - max_val) < sqrt (eps)) + min_val *= 0.9; + max_val *= 1.1; endif min_val = 10 ^ floor (log10 (min_val)); max_val = 10 ^ ceil (log10 (max_val)); @@ -717,9 +718,10 @@ if (min_val == 0 && max_val == 0) min_val = -1; max_val = 1; - elseif (min_val == max_val) - min_val = 0.9 * min_val; - max_val = 1.1 * max_val; + ## FIXME -- maybe this test should also be relative? + elseif (abs (min_val - max_val) < sqrt (eps)) + min_val -= 0.1 * abs (min_val); + max_val += 0.1 * abs (max_val); endif ## FIXME -- to do a better job, we should consider the tic spacing. scale = 10 ^ floor (log10 (max_val - min_val) - 1);