Mercurial > octave-nkf
comparison scripts/plot/__go_draw_axes__.m @ 6512:747ba2dc157e
[project @ 2007-04-10 20:38:57 by jwe]
author | jwe |
---|---|
date | Tue, 10 Apr 2007 20:38:57 +0000 |
parents | cbae86745c5b |
children | 2a04f026ef54 |
comparison
equal
deleted
inserted
replaced
6511:73ce4e14d35d | 6512:747ba2dc157e |
---|---|
705 if (max_val < 0) | 705 if (max_val < 0) |
706 max_val = min_pos; | 706 max_val = min_pos; |
707 endif | 707 endif |
708 warning ("axis: omitting negative data in log plot"); | 708 warning ("axis: omitting negative data in log plot"); |
709 endif | 709 endif |
710 if (min_val == max_val) | 710 ## FIXME -- maybe this test should also be relative? |
711 min_val = 0.9 * min_val; | 711 if (abs (min_val - max_val) < sqrt (eps)) |
712 max_val = 1.1 * max_val; | 712 min_val *= 0.9; |
713 max_val *= 1.1; | |
713 endif | 714 endif |
714 min_val = 10 ^ floor (log10 (min_val)); | 715 min_val = 10 ^ floor (log10 (min_val)); |
715 max_val = 10 ^ ceil (log10 (max_val)); | 716 max_val = 10 ^ ceil (log10 (max_val)); |
716 else | 717 else |
717 if (min_val == 0 && max_val == 0) | 718 if (min_val == 0 && max_val == 0) |
718 min_val = -1; | 719 min_val = -1; |
719 max_val = 1; | 720 max_val = 1; |
720 elseif (min_val == max_val) | 721 ## FIXME -- maybe this test should also be relative? |
721 min_val = 0.9 * min_val; | 722 elseif (abs (min_val - max_val) < sqrt (eps)) |
722 max_val = 1.1 * max_val; | 723 min_val -= 0.1 * abs (min_val); |
724 max_val += 0.1 * abs (max_val); | |
723 endif | 725 endif |
724 ## FIXME -- to do a better job, we should consider the tic spacing. | 726 ## FIXME -- to do a better job, we should consider the tic spacing. |
725 scale = 10 ^ floor (log10 (max_val - min_val) - 1); | 727 scale = 10 ^ floor (log10 (max_val - min_val) - 1); |
726 min_val = scale * floor (min_val / scale); | 728 min_val = scale * floor (min_val / scale); |
727 max_val = scale * ceil (max_val / scale); | 729 max_val = scale * ceil (max_val / scale); |