Mercurial > hg > octave-nkf
changeset 12549:570193964185
graphics.cc: Prevent ticks from being cropped.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Tue, 29 Mar 2011 19:00:26 -0400 |
parents | 2ba9478f6520 |
children | ea3a4bf39048 |
files | src/ChangeLog src/graphics.cc |
diffstat | 2 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-29 Ben Abbott <bpabbott@mac.com> + + * graphics.cc: Prevent ticks from being cropped by round-off errors + when limmode == auto (bug #32701). + 2011-03-28 Rik <octave@nomad.inbox5.com> * DLD-FUNCTIONS/inv.cc (inv, inverse), DLD-FUNCTIONS/tril.cc (tril),
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -5082,8 +5082,11 @@ } double tick_sep = calc_tick_sep (min_val , max_val); - min_val = tick_sep * gnulib::floor (min_val / tick_sep); - max_val = tick_sep * std::ceil (max_val / tick_sep); + double min_tick = gnulib::floor (min_val / tick_sep); + double max_tick = std::ceil (max_val / tick_sep); + // Prevent round-off from cropping ticks + min_val = std::min (min_val, tick_sep * min_tick); + max_val = std::max (max_val, tick_sep * max_tick); } } @@ -5132,8 +5135,8 @@ { // adjust limits to include min and max tics Matrix tmp_lims (1,2); - tmp_lims(0) = tick_sep * i1; - tmp_lims(1) = tick_sep * i2; + tmp_lims(0) = std::min (tick_sep * i1, lo); + tmp_lims(1) = std::max (tick_sep * i2, hi); if (is_logscale) {