changeset 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 8d5f0b41e6b0
children 62e710cea7f1
files scripts/plot/axis.m
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/axis.m	Sat Sep 17 21:55:38 2011 -0500
+++ b/scripts/plot/axis.m	Sun Sep 18 11:05:12 2011 -0400
@@ -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
+