changeset 6278:300fb48803e3

[project @ 2007-02-07 22:23:37 by jwe]
author jwe
date Wed, 07 Feb 2007 22:23:37 +0000
parents bdfb345dab8d
children 195382e92d51
files scripts/ChangeLog scripts/plot/__uiobject_draw_axes__.m scripts/plot/close.m scripts/plot/sombrero.m
diffstat 4 files changed, 27 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Feb 07 09:13:45 2007 +0000
+++ b/scripts/ChangeLog	Wed Feb 07 22:23:37 2007 +0000
@@ -1,3 +1,12 @@
+2007-02-07  John W. Eaton  <jwe@octave.org>
+
+	* plot/sombrero.m: Call box ("off") after mesh.
+
+	* plot/__uiobject_draw_axes__.m: Avoid rgb colors and "set style
+	line default" commands with older versions of gnuplot.
+
+	* plot/close.m: Use get (0, "currentifgure") instead of gcf.
+
 2007-02-06  John W. Eaton  <jwe@octave.org>
 
 	* plot/__uiobject_draw_axes__.m: Set pt to 0 if marker is ".".
--- a/scripts/plot/__uiobject_draw_axes__.m	Wed Feb 07 09:13:45 2007 +0000
+++ b/scripts/plot/__uiobject_draw_axes__.m	Wed Feb 07 22:23:37 2007 +0000
@@ -271,7 +271,7 @@
 	    if (zautoscale)
 	      zmin = min (zmin, min (zdat));
 	      zmax = max (zmax, max (zdat));
-	      zminp = min (zminp, min (zdat(ydat>0)));
+	      zminp = min (zminp, min (zdat(zdat>0)));
 	    endif
 	    data{data_idx} = [xdat, ydat, zdat]';
 	    usingclause{data_idx} = "using ($1):($2):($3)";
@@ -399,9 +399,9 @@
 	    yminp = min (yminp, min (ty(ty>0)));
 	  endif
 	  if (zautoscale)
-	    tz = xdat(:);
-	    zmin = min (ymin, min (tz));
-	    zmax = max (ymax, max (tz));
+	    tz = zdat(:);
+	    zmin = min (zmin, min (tz));
+	    zmax = max (zmax, max (tz));
 	    zminp = min (zminp, min (tz(tz>0)));
 	  endif
 	  err = false;
@@ -665,12 +665,16 @@
 
 function style = do_linestyle_command (obj, idx, plot_stream)
 
-  fprintf (plot_stream, "set style line %d default;\n", idx);
+  have_newer_gnuplot = compare_versions (__gnuplot_version__ (), "4.0", ">");
+
+  if (have_newer_gnuplot)
+    fprintf (plot_stream, "set style line %d default;\n", idx);
+  endif
   fprintf (plot_stream, "set style line %d", idx);
 
   found_style = false;
 
-  if (isfield (obj, "color"))
+  if (isfield (obj, "color") && have_newer_gnuplot)
     color = obj.color;
     if (isnumeric (color))
       fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
@@ -758,7 +762,7 @@
     style = "linespoints";
   endif
 
-  if (! found_style)
+  if (have_newer_gnuplot && ! found_style)
     fputs (plot_stream, " default");
   endif
 
--- a/scripts/plot/close.m	Wed Feb 07 09:13:45 2007 +0000
+++ b/scripts/plot/close.m	Wed Feb 07 22:23:37 2007 +0000
@@ -32,8 +32,12 @@
 function retval = close (arg1, arg2)
 
   if (nargin == 0)
-    ## Close current figure.
-    figs = gcf ();
+    ## Close current figure.  Don't use gcf because that will open a new
+    ## plot window if one doesn't exist.
+    figs = get (0, "currentfigure");
+    if (! isempty (figs) && figs == 0)
+      figs = [];
+    endif
   elseif (nargin == 1)
     if (ischar (arg1) && strcmp (arg1, "all"))
       ## Close all figures.
--- a/scripts/plot/sombrero.m	Wed Feb 07 09:13:45 2007 +0000
+++ b/scripts/plot/sombrero.m	Wed Feb 07 22:23:37 2007 +0000
@@ -44,6 +44,7 @@
       tz = sin (r) ./ r;
       if (nargout == 0)
         mesh (tx, ty, tz);
+	box ("off");
       else
 	x = tx;
 	y = ty;