changeset 7008:0058799917ac

[project @ 2007-10-11 17:17:02 by jwe]
author jwe
date Thu, 11 Oct 2007 17:17:03 +0000
parents 6304d9ea0a30
children b353c370a315
files scripts/ChangeLog scripts/plot/__go_draw_axes__.m
diffstat 2 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Oct 11 16:26:37 2007 +0000
+++ b/scripts/ChangeLog	Thu Oct 11 17:17:03 2007 +0000
@@ -1,3 +1,9 @@
+2007-10-11  John W. Eaton  <jwe@octave.org>
+
+	* plot/__go_draw_axes__.m (get_axis_limits):
+	Return lim = [] if logscale and no positive values.
+	(__go_draw_axes__): Skip plotting if computed axis limits are empty.
+
 2007-10-11  Brian Gough  <bjg@network-theory.co.uk>
 
 	* control/csrefcard.lt, control/system/is_detectable.m,
--- a/scripts/plot/__go_draw_axes__.m	Thu Oct 11 16:26:37 2007 +0000
+++ b/scripts/plot/__go_draw_axes__.m	Thu Oct 11 17:17:03 2007 +0000
@@ -694,6 +694,9 @@
 
     if (xautoscale && have_data)
       xlim = get_axis_limits (xmin, xmax, xminp, xlogscale);
+      if (isempty (xlim))
+	return;
+      endif
       set (h, "xlim", xlim, "xlimmode", "auto");
     else
       xlim = axis_obj.xlim;
@@ -707,6 +710,9 @@
 
     if (yautoscale && have_data)
       ylim = get_axis_limits (ymin, ymax, yminp, ylogscale);
+      if (isempty (ylim))
+	return;
+      endif
       set (h, "ylim", ylim, "ylimmode", "auto");
     else
       ylim = axis_obj.ylim;
@@ -721,6 +727,9 @@
     if (nd == 3)
       if (zautoscale && have_data)
 	zlim = get_axis_limits (zmin, zmax, zminp, zlogscale);
+	if (isempty (zlim))
+	  return;
+	endif
 	set (h, "zlim", zlim, "zlimmode", "auto");
       else
 	zlim = axis_obj.zlim;
@@ -875,15 +884,14 @@
 function lim = get_axis_limits (min_val, max_val, min_pos, logscale)
 
   if (logscale)
-    if (isinf (min_pos))
+    if (isinf (min_pos) || isempty (min_pos))
+      lim = [];
       warning ("axis: logscale with no positive values to plot");
+      return;
     endif
     if (min_val <= 0)
+      warning ("axis: omitting nonpositive data in log plot");
       min_val = min_pos;
-      if (max_val <= 0)
-	max_val = min_pos;
-      endif
-      warning ("axis: omitting nonpositive data in log plot");
     endif
     ## FIXME -- maybe this test should also be relative?
     if (abs (min_val - max_val) < sqrt (eps))