changeset 14063:6875d23ce051 stable

Fix regression of tight axis limits introduced by changeset ec79cd8359c5. * axis.m: Fix regression of tight axis limits introduced by changeset ec79cd8359c5. Add test.
author Ben Abbott <bpabbott@mac.com>
date Fri, 16 Dec 2011 07:59:58 -0500
parents 5b49cafe0599
children 0b748d4284de
files scripts/plot/axis.m
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/axis.m	Thu Dec 15 22:03:03 2011 -0800
+++ b/scripts/plot/axis.m	Fri Dec 16 07:59:58 2011 -0500
@@ -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
+