changeset 11998:abe4d6657872 release-3-2-x

axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
author Ben Abbott <bpabbott@mac.com>
date Thu, 18 Jun 2009 07:09:17 +0200
parents 5530fe42c83b
children 49affc56fac2
files scripts/ChangeLog scripts/plot/axis.m
diffstat 2 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-17  Bertrand Roessli <bertrand.roessli@psi.ch>
+
+	* plot/axis.m: Fix bug for 'axis tight' with multiple surface plots,
+	add demo.
+
 2009-06-14  Ben Abbott <bpabbott@mac.com>
 
 	* plot/quiver.m: Add 'clf' to demos.
--- a/scripts/plot/axis.m
+++ b/scripts/plot/axis.m
@@ -300,8 +300,9 @@
     if (iscell (data))
       data = data (find (! cellfun (@isempty, data)));
       if (! isempty (data))
-        lims(1) = min (cellfun (@min, data)(:));
-        lims(2) = max (cellfun (@max, data)(:));
+        lims_min = min (cellfun (@min, cellfun (@min, data, 'UniformOutput', false)(:))); 
+        lims_max = max (cellfun (@max, cellfun (@max, data, 'UniformOutput', false)(:))); 
+        lims = [lims_min, lims_max]; 
       else
         lims = [0, 1];
       endif
@@ -309,6 +310,8 @@
       lims = [min(data(:)), max(data(:))];
     endif
   endif
+
+
 endfunction
 
 function __do_tight_option__ (ca)
@@ -445,4 +448,14 @@
 %! axis image
 %! title("image")
 
+%!demo
+%! clf
+%! [x,y,z] = peaks(50);
+%! x1 = max(x(:));
+%! pcolor(x-x1,y-x1/2,z)
+%! hold on
+%! [x,y,z] = sombrero;
+%! s = x1/max(x(:));
+%! pcolor(s*x+x1,s*y+x1/2,5*z)
+%! axis tight