changeset 11976:67461f17c12a release-3-2-x

axis.m: Fix bug for 'axis tight' with multiple lines, modify demo.
author Ben Abbott <bpabbott@mac.com>
date Tue, 09 Jun 2009 06:33:10 +0200
parents 5183cee7a423
children 854863bb29e8
files scripts/ChangeLog scripts/plot/axis.m
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Jun 09 06:33:10 2009 +0200
+++ b/scripts/ChangeLog	Tue Jun 09 06:33:10 2009 +0200
@@ -1,3 +1,8 @@
+2009-06-08  Ben Abbott <bpabbott@mac.com>
+
+	* plot/axis.m: Fix bug for 'axis tight' with multiple lines, modify
+	demo.
+
 2009-06-07  Thorsten Meyer  <thorsten.meyier@gmx.de>
 
 	* testfun/assert.m: Fix texinfo bug.
--- a/scripts/plot/axis.m	Tue Jun 09 06:33:10 2009 +0200
+++ b/scripts/plot/axis.m	Tue Jun 09 06:33:10 2009 +0200
@@ -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");