Mercurial > octave
changeset 23961:20dd13700c08 stable
Correct auto limits on log axes with negative and zero values (bug #51861).
* graphics.cc (axes::properties::get_axis_limits): Correct auto limits
on axes with logarithmic scale that span from negative values to zero.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 27 Aug 2017 13:22:51 +0200 |
parents | 4f4d28796934 |
children | 882dd1c0017f 16fae04366b2 |
files | libinterp/corefcn/graphics.cc |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc Mon Aug 28 10:20:26 2017 +0200 +++ b/libinterp/corefcn/graphics.cc Sun Aug 27 13:22:51 2017 +0200 @@ -6804,10 +6804,15 @@ retval(1) = pow (10., retval(1)); return retval; } - if (min_val <= 0 && max_val > 0) + if (min_val <= 0) { - warning ("axis: omitting non-positive data in log plot"); - min_val = min_pos; + if (max_val > 0) + { + warning ("axis: omitting non-positive data in log plot"); + min_val = min_pos; + } + else if (max_val == 0) + max_val = max_neg; } // FIXME: maybe this test should also be relative? if (std::abs (min_val - max_val)