# HG changeset patch # User John W. Eaton # Date 1203584382 18000 # Node ID 4bfe1ab20e995abe1b9b9c79570dd7119307328b # Parent 087af2a4ca269f7bdc6835cf8bdf5ee3b9260520 fsolve: detect nonsquare systems diff -r 087af2a4ca26 -r 4bfe1ab20e99 scripts/ChangeLog --- a/scripts/ChangeLog Thu Feb 21 03:05:27 2008 -0500 +++ b/scripts/ChangeLog Thu Feb 21 03:59:42 2008 -0500 @@ -1,3 +1,10 @@ +2008-02-21 John W. Eaton + + * plot/errorbar.m: If nargout > 0, return vector of handles to + line objects. + * plot/__go_draw_axes__.m: Improve handling of line style for + errorbar plots. + 2008-02-20 John W. Eaton * strings/strcat.m: Detect cellstr args. diff -r 087af2a4ca26 -r 4bfe1ab20e99 scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m Thu Feb 21 03:05:27 2008 -0500 +++ b/scripts/plot/__go_draw_axes__.m Thu Feb 21 03:59:42 2008 -0500 @@ -397,16 +397,8 @@ tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "keylabel", have_newer_gnuplot)); titlespec{data_idx} = strcat ("title \"", tmp, "\""); endif - [style, typ, with] = do_linestyle_command (obj, data_idx, - mono, plot_stream); usingclause{data_idx} = ""; - if (have_newer_gnuplot || isnan (typ)) - withclause{data_idx} = sprintf ("with %s linestyle %d", - style, data_idx); - else - withclause{data_idx} = sprintf ("with %s linetype %d", - style, typ); - endif + errbars = ""; if (nd == 3) xdat = obj.xdata(:); ydat = obj.ydata(:); @@ -464,11 +456,11 @@ endif data{data_idx} = [xdat, ydat, xlo, xhi, ylo, yhi]'; usingclause{data_idx} = "using ($1):($2):($3):($4):($5):($6)"; - withclause{data_idx} = "with xyerrorbars"; + errbars = "xyerrorbars"; else data{data_idx} = [xdat, ydat, ylo, yhi]'; usingclause{data_idx} = "using ($1):($2):($3):($4)"; - withclause{data_idx} = "with yerrorbars"; + errbars = "yerrorbars"; endif elseif (xerr) if (isempty (xldat)) @@ -483,13 +475,25 @@ endif data{data_idx} = [xdat, ydat, xlo, xhi]'; usingclause{data_idx} = "using ($1):($2):($3):($4)"; - withclause{data_idx} = "with xerrorbars"; + errbars = "xerrorbars"; else data{data_idx} = [xdat, ydat]'; usingclause{data_idx} = sprintf ("using ($1):($2) axes %s%s", xaxisloc_using, yaxisloc_using); endif endif + + [style, typ, with] = do_linestyle_command (obj, data_idx, mono, + plot_stream, errbars); + + if (have_newer_gnuplot || isnan (typ)) + withclause{data_idx} = sprintf ("with %s linestyle %d", + style, data_idx); + else + withclause{data_idx} = sprintf ("with %s linetype %d", + style, typ); + endif + if (! (have_newer_gnuplot || isempty (with))) if (isempty (withclause{data_idx})) withclause{data_idx} = sprintf ("with %s", with); @@ -1257,7 +1261,8 @@ endfunction -function [style, typ, with] = do_linestyle_command (obj, idx, mono, plot_stream) +function [style, typ, with] = do_linestyle_command (obj, idx, mono, + plot_stream, errbars) persistent have_newer_gnuplot ... = compare_versions (__gnuplot_version__ (), "4.0", ">"); @@ -1392,23 +1397,28 @@ pt = ""; endif - style = "lines"; - if (isempty (lt)) - if (! isempty (pt)) - style = "points"; + if (isempty (errbars)) + style = "lines"; + if (isempty (lt)) + if (! isempty (pt)) + style = "points"; + endif + elseif (! isempty (pt)) + style = "linespoints"; endif - elseif (! isempty (pt)) - style = "linespoints"; - endif - if (isfield (obj, "markersize")) - if (have_newer_gnuplot) - fprintf (plot_stream, " pointsize %f", obj.markersize); - else - if (! strcmpi (style, "lines")) - with = sprintf ("%s ps %f", with, obj.markersize); + if (isfield (obj, "markersize")) + if (have_newer_gnuplot) + fprintf (plot_stream, " pointsize %f", obj.markersize); + else + if (! strcmpi (style, "lines")) + with = sprintf ("%s ps %f", with, obj.markersize); + endif endif + found_style = true; endif + else + style = errbars; found_style = true; endif diff -r 087af2a4ca26 -r 4bfe1ab20e99 scripts/plot/errorbar.m --- a/scripts/plot/errorbar.m Thu Feb 21 03:05:27 2008 -0500 +++ b/scripts/plot/errorbar.m Thu Feb 21 03:59:42 2008 -0500 @@ -108,7 +108,7 @@ ## Author: Teemu Ikonen ## Keywords: errorbar, plotting -function errorbar (varargin) +function retval = errorbar (varargin) [h, varargin] = __plt_get_axis_arg__ ("errorbar", varargin{:}); @@ -116,7 +116,12 @@ unwind_protect axes (h); newplot (); - __errcomm__ ("errorbar", h, varargin{:}); + + tmp = __errcomm__ ("errorbar", h, varargin{:}); + + if (nargout > 0) + retval = tmp; + endif unwind_protect_cleanup axes (oldh); end_unwind_protect