# HG changeset patch # User Ben Abbott # Date 1244478907 14400 # Node ID 96abf8f7e5b66b3dd8536b4c585233f015cc4d62 # Parent c539ec5726e773a13c6574ac0b5df26433c35325 axis.m: Fix bug for 'axis tight' with multiple lines, modify demo. diff -r c539ec5726e7 -r 96abf8f7e5b6 scripts/ChangeLog --- a/scripts/ChangeLog Sun Jun 07 20:12:16 2009 -0700 +++ b/scripts/ChangeLog Mon Jun 08 12:35:07 2009 -0400 @@ -1,3 +1,8 @@ +2009-06-08 Ben Abbott + + * plot/axis.m: Fix bug for 'axis tight' with multiple lines, modify + demo. + 2009-06-07 Thorsten Meyer * testfun/assert.m: Fix texinfo bug. diff -r c539ec5726e7 -r 96abf8f7e5b6 scripts/plot/axis.m --- 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");