# HG changeset patch # User jwe # Date 1170887017 0 # Node ID 300fb48803e3c67ca5d154312d036483e3fc8d89 # Parent bdfb345dab8da57cf1ad643a3b0b26b77c72f9ef [project @ 2007-02-07 22:23:37 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,12 @@ +2007-02-07 John W. Eaton + + * 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 * plot/__uiobject_draw_axes__.m: Set pt to 0 if marker is ".". diff --git a/scripts/plot/__uiobject_draw_axes__.m b/scripts/plot/__uiobject_draw_axes__.m --- a/scripts/plot/__uiobject_draw_axes__.m +++ b/scripts/plot/__uiobject_draw_axes__.m @@ -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 diff --git a/scripts/plot/close.m b/scripts/plot/close.m --- a/scripts/plot/close.m +++ b/scripts/plot/close.m @@ -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. diff --git a/scripts/plot/sombrero.m b/scripts/plot/sombrero.m --- a/scripts/plot/sombrero.m +++ b/scripts/plot/sombrero.m @@ -44,6 +44,7 @@ tz = sin (r) ./ r; if (nargout == 0) mesh (tx, ty, tz); + box ("off"); else x = tx; y = ty;