diff scripts/plot/axis.m @ 9317:96abf8f7e5b6

axis.m: Fix bug for 'axis tight' with multiple lines, modify demo.
author Ben Abbott <bpabbott@mac.com>
date Mon, 08 Jun 2009 12:35:07 -0400
parents be84e9654feb
children 95ec56601497
line wrap: on
line diff
--- a/scripts/plot/axis.m	Sun Jun 07 20:12:16 2009 -0700
+++ b/scripts/plot/axis.m	Mon Jun 08 12:35:07 2009 -0400
@@ -298,14 +298,17 @@
   else
     data = get (kids, strcat (ax, "data"));
     if (iscell (data))
-      lims(1) = min (cellfun (@min, data)(:));
-      lims(2) = min (cellfun (@max, data)(:));
+      data = data (find (! cellfun (@isempty, data)));
+      if (! isempty (data))
+        lims(1) = min (cellfun (@min, data)(:));
+        lims(2) = max (cellfun (@max, data)(:));
+      else
+        lims = [0, 1];
+      endif
     else
       lims = [min(data(:)), max(data(:))];
     endif
   endif
-
-
 endfunction
 
 function __do_tight_option__ (ca)
@@ -430,7 +433,7 @@
 %! title("axes at [3 6 0 1], then autoy");
 %!
 %! subplot(326);
-%! plot(t, x);
+%! plot(t, sin(t), t, -2*sin(t/2))
 %! axis("tight");
 %! title("tight");