comparison scripts/plot/axis.m @ 9357:95ec56601497

axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
author Ben Abbott <bpabbott@mac.com>
date Wed, 17 Jun 2009 18:49:46 -0400
parents 96abf8f7e5b6
children 7b74a7fd4761
comparison
equal deleted inserted replaced
9356:b2133f97079d 9357:95ec56601497
298 else 298 else
299 data = get (kids, strcat (ax, "data")); 299 data = get (kids, strcat (ax, "data"));
300 if (iscell (data)) 300 if (iscell (data))
301 data = data (find (! cellfun (@isempty, data))); 301 data = data (find (! cellfun (@isempty, data)));
302 if (! isempty (data)) 302 if (! isempty (data))
303 lims(1) = min (cellfun (@min, data)(:)); 303 lims_min = min (cellfun (@min, cellfun (@min, data, 'UniformOutput', false)(:)));
304 lims(2) = max (cellfun (@max, data)(:)); 304 lims_max = max (cellfun (@max, cellfun (@max, data, 'UniformOutput', false)(:)));
305 lims = [lims_min, lims_max];
305 else 306 else
306 lims = [0, 1]; 307 lims = [0, 1];
307 endif 308 endif
308 else 309 else
309 lims = [min(data(:)), max(data(:))]; 310 lims = [min(data(:)), max(data(:))];
310 endif 311 endif
311 endif 312 endif
313
314
312 endfunction 315 endfunction
313 316
314 function __do_tight_option__ (ca) 317 function __do_tight_option__ (ca)
315 318
316 set (ca, 319 set (ca,
443 %! x=0:0.1:10; 446 %! x=0:0.1:10;
444 %! plot(x,sin(x)) 447 %! plot(x,sin(x))
445 %! axis image 448 %! axis image
446 %! title("image") 449 %! title("image")
447 450
448 451 %!demo
452 %! clf
453 %! [x,y,z] = peaks(50);
454 %! x1 = max(x(:));
455 %! pcolor(x-x1,y-x1/2,z)
456 %! hold on
457 %! [x,y,z] = sombrero;
458 %! s = x1/max(x(:));
459 %! pcolor(s*x+x1,s*y+x1/2,5*z)
460 %! axis tight
461