Mercurial > hg > octave-lyh
diff scripts/plot/axis.m @ 13154:0c3b1a359998 stable
Fix bug #33606.
* scripts/plot/axis.m: tight axis limits for log plots.
Start all demos with clf() for repeatable results.
author | Marco Caliari <marco.caliar@univr.it> |
---|---|
date | Sun, 18 Sep 2011 11:05:12 -0400 |
parents | d2997525fcb6 |
children | 536c6a5ab705 bd2cd4fd3edf |
line wrap: on
line diff
--- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -320,7 +320,13 @@ data = get (kids, strcat (ax, "data")); scale = get (ca, strcat (ax, "scale")); if (strcmp (scale, "log")) - data(data<=0) = NaN; + if (iscell (data)) + for i = 1:length(data) + data{i}(data{i}<=0) = NaN; + end + else + data(data<=0) = NaN; + end end if (iscell (data)) data = data (find (! cellfun (@isempty, data))); @@ -350,6 +356,7 @@ endfunction %!demo +%! clf %! t=0:0.01:2*pi; x=sin(t); %! %! subplot(221); @@ -372,6 +379,7 @@ %! axis("normal"); %!demo +%! clf %! t=0:0.01:2*pi; x=sin(t); %! %! subplot(121); @@ -385,6 +393,7 @@ %! axis("xy"); %!demo +%! clf %! t=0:0.01:2*pi; x=sin(t); %! %! subplot(331); @@ -433,6 +442,7 @@ %! axis("on"); %!demo +%! clf %! t=0:0.01:2*pi; x=sin(t); %! %! subplot(321); @@ -493,3 +503,8 @@ %! legend ({"x >= 1", "x <= 1"}, "location", "north") %! title ("ylim = [1, 10]") +%!demo +%! clf +%! loglog (1:20, "-s") +%! axis tight +