Mercurial > hg > octave-lyh
changeset 17312:4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
* scripts/plot/private/__errplot__.m: If data values are all negative, take
the absolute value before using log to calculate data range.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 21 Aug 2013 09:08:11 -0700 |
parents | 8520c264619c |
children | ab71b9829752 |
files | scripts/plot/private/__errplot__.m |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/private/__errplot__.m +++ b/scripts/plot/private/__errplot__.m @@ -228,7 +228,11 @@ xhi = xdata + dx; else n = xdata > 0; - rx = exp (0.01 * (max (log (xdata(n))) - min (log (xdata(n))))); + if (! any (n)) + n = xdata < 0; + endif + logdata = log (abs (xdata(n))); + rx = exp (0.01 * (max (logdata) - min (logdata))); xlo = xdata/rx; xhi = xdata*rx; endif @@ -238,7 +242,11 @@ yhi = ydata + dy; else n = ydata > 0; - ry = exp (0.01 * (max (log (ydata(n))) - min (log (ydata(n))))); + if (! any (n)) + n = ydata < 0; + endif + logdata = log (abs (ydata(n))); + ry = exp (0.01 * (max (logdata) - min (logdata))); ylo = ydata/ry; yhi = ydata*ry; endif