changeset 11655:4bfe1ab20e99 release-3-0-x

fsolve: detect nonsquare systems
author John W. Eaton <jwe@octave.org>
date Thu, 21 Feb 2008 03:59:42 -0500
parents 087af2a4ca26
children 86bf8c2c3fc1
files scripts/ChangeLog scripts/plot/__go_draw_axes__.m scripts/plot/errorbar.m
diffstat 3 files changed, 50 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- 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  <jwe@octave.org>
+
+	* 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  <jwe@octave.org>
 
 	* strings/strcat.m: Detect cellstr args.
--- 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
 
--- 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 <tpikonen@pcu.helsinki.fi>
 ## 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