# HG changeset patch # User Ben Abbott # Date 1324040398 18000 # Node ID 6875d23ce0512982bbdad7b0a38d02603fb0dc1c # Parent 5b49cafe059982abb905d14038b8340ab709c905 Fix regression of tight axis limits introduced by changeset ec79cd8359c5. * axis.m: Fix regression of tight axis limits introduced by changeset ec79cd8359c5. Add test. diff --git a/scripts/plot/axis.m b/scripts/plot/axis.m --- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -323,7 +323,10 @@ data = {data}; end if (strcmp (scale, "log")) - data = cellfun (@(x) x(x>0), data, "uniformoutput", false); + tmp = data; + data = cellfun (@(x) x(x>0), tmp, "uniformoutput", false); + n = cellfun (@isempty, data); + data(n) = cellfun (@(x) x(x<0), tmp(n), "uniformoutput", false); endif data = cellfun (@(x) x(isfinite(x)), data, "uniformoutput", false); data = data(! cellfun ("isempty", data)); @@ -554,8 +557,19 @@ %! hold all; %! plot (11:20, 25.5 + rand (10)); %! axis tight; -%! assert (axis, [11 20 21 30]); +%! assert (axis (), [11 20 21 30]); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! a = logspace (-5, 1, 10); +%! loglog (a, -a) +%! axis tight; +%! assert (axis (), [1e-5, 10, -10, -1e-5]) +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect +