changeset 7462:dfcaf7ed48e3

Allow linewidth to be specified for contours
author David Bateman
date Fri, 08 Feb 2008 12:30:39 +0100
parents da8e4aa06134
children 2467639bd8c0
files scripts/ChangeLog scripts/plot/__contour__.m scripts/plot/__go_draw_axes__.m
diffstat 3 files changed, 39 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Feb 08 03:43:48 2008 -0500
+++ b/scripts/ChangeLog	Fri Feb 08 12:30:39 2008 +0100
@@ -2,6 +2,12 @@
 
 	* audio/wavread.m: Limit data read to end of data chunk.
 
+2008-02-08  David Bateman  <dbateman@free.fr?
+
+	* plot/__contour__.m: Respect the graphic handle options that are
+	passed.
+	* plot/__go_draw_axes__.m: Respect the linewidth for patch objects.
+
 2008-02-01  Dave Goel  <deego3@gmail.com>
 
 	* signal/arch_rnd.m: Correctly index E and Y vectors.
--- a/scripts/plot/__contour__.m	Fri Feb 08 03:43:48 2008 -0500
+++ b/scripts/plot/__contour__.m	Fri Feb 08 12:30:39 2008 +0100
@@ -28,7 +28,7 @@
   for i = 3 : nargin
     arg = varargin {i};
     if ((ischar (arg) || iscell (arg)))
-      [linespec, valid] = __pltopt__ ("quiver", arg, false);
+      [linespec, valid] = __pltopt__ ("contour", arg, false);
       if (isempty (linespec.color))
 	linespec.color = "flat";
       endif
@@ -40,15 +40,24 @@
     endif
   endfor
 
+  opts = {};
+  i = 3;
+  while (i < length (varargin))
+    if (ischar (varargin {i}))
+      opts{end+1} = varargin{i};
+      varargin(i) = [];
+      opts{end+1} = varargin{i};
+      varargin(i) = [];
+    else
+      i++;
+    endif
+  endwhile
+
   if (ischar (z))
     if (strcmp (z, "none"))
       z = NaN;
     elseif (strcmp (z, "base"))
-      if (nargin < 3)
-	z = varargin{1};
-      else
-	z = varargin{3};
-      endif
+      z = varargin{3};
       z = 2 * (min (z(:)) - max (z(:)));
     elseif (! strcmp (z, "level"))
       error ("unrecognized z argument");
@@ -73,15 +82,15 @@
     if (isnan (z))
       h = [h; patch(ax, p(1,:), p(2,:), "facecolor", "none", 
 		    "edgecolor", linespec.color, "linestyle", 
-		    linespec.linestyle, "cdata", clev)];
+		    linespec.linestyle, "cdata", clev, opts{:})];
     elseif (!ischar(z))
       h = [h; patch(ax, p(1,:), p(2,:), z * ones (1, columns (p)), "facecolor",
 		    "none", "edgecolor", linespec.color, 
-		    "linestyle", linespec.linestyle, "cdata", clev)];
+		    "linestyle", linespec.linestyle, "cdata", clev, opts{:})];
     else
       h = [h; patch(ax, p(1,:), p(2,:), clev * ones (1, columns (p)),
 		    "facecolor", "none", "edgecolor", linespec.color, 
-		    "linestyle", linespec.linestyle, "cdata", clev)];
+		    "linestyle", linespec.linestyle, "cdata", clev, opts{:})];
     endif
     i1 += clen+1;
   endwhile
--- a/scripts/plot/__go_draw_axes__.m	Fri Feb 08 03:43:48 2008 -0500
+++ b/scripts/plot/__go_draw_axes__.m	Fri Feb 08 12:30:39 2008 +0100
@@ -694,6 +694,16 @@
 	       lt = "";
 	     endif
 
+	     if (isfield (obj, "linewidth"))
+	       if (have_newer_gnuplot)
+		 lw = sprintf("linewidth %f", obj.linewidth);
+	       else
+		 lw = sprintf("lw %f", obj.linewidth);
+	       endif
+	     else
+	       lw  = "";
+	     endif
+
 	     if (isfield (obj, "marker"))
 	       if (isfield (obj, "marker"))
 		 switch (obj.marker)
@@ -768,8 +778,9 @@
 		 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
 				      round (255*color));
 	       endif
-	       withclause{data_idx} = sprintf ("with %s %s %s %s %s",
-					       style, pt, lt, ps, colorspec);
+	       withclause{data_idx} = sprintf ("with %s %s %s %s %s %s",
+					       style, lw, pt, lt, ps, 
+					       colorspec);
 	     else
 	       if (isequal (color, [0,0,0]))
 		 typ = -1;
@@ -790,8 +801,8 @@
 	       else
 		 typ = -1;
 	       endif
-	       withclause{data_idx} = sprintf ("with %s %s %s lt %d", 
-					       style, pt, ps, typ);
+	       withclause{data_idx} = sprintf ("with %s %s %s %s lt %d", 
+					       style, lw, pt, ps, typ);
 	     endif
 
 	     if (nd == 3)