changeset 7317:11c5f1ee553e

[project @ 2007-12-14 17:42:55 by jwe]
author jwe
date Fri, 14 Dec 2007 17:43:34 +0000
parents fac781a4078d
children 5c8f09c7a020
files scripts/ChangeLog scripts/plot/__contour__.m scripts/plot/__go_draw_axes__.m scripts/plot/contour.m scripts/plot/contour3.m src/graphics.cc
diffstat 6 files changed, 56 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Dec 14 17:32:25 2007 +0000
+++ b/scripts/ChangeLog	Fri Dec 14 17:43:34 2007 +0000
@@ -1,5 +1,10 @@
 2007-12-14  David Bateman  <dbateman@free.fr>
 
+	* plot/contour3.m, plot/__contour__.m: Handle linespec.
+	* plot/contour.m: Doc fix.
+	* plot/__go_draw_axes__.m (case "patch"): Include "lt" in lt string.
+	Include linetype in withclause.
+
 	* plot/__go_draw_axes__.m (__calc_dimensions__): New function.
 	Use it to determine dimensions.  Consolidate all 3-d settings.
 
--- a/scripts/plot/__contour__.m	Fri Dec 14 17:32:25 2007 +0000
+++ b/scripts/plot/__contour__.m	Fri Dec 14 17:43:34 2007 +0000
@@ -23,11 +23,28 @@
   ax = varargin{1};
   z = varargin{2};
 
+  linespec.linestyle = "-";
+  linespec.color = "flat";
+  for i = 3 : nargin
+    arg = varargin {i};
+    if ((ischar (arg) || iscell (arg)))
+      [linespec, valid] = __pltopt__ ("quiver", arg, false);
+      if (isempty (linespec.color))
+	linespec.color = "flat";
+      endif
+      if (valid)
+	have_line_spec = true;
+	varargin(i) = [];
+	break;
+      endif
+    endif
+  endfor
+
   if (ischar (z))
     if (strcmp (z, "none"))
       z = NaN;
     elseif (strcmp (z, "base"))
-      if (nargin == 1)
+      if (nargin < 3)
 	z = varargin{1};
       else
 	z = varargin{3};
@@ -55,13 +72,16 @@
 
     if (isnan (z))
       h = [h; patch(ax, p(1,:), p(2,:), "facecolor", "none", 
-		    "edgecolor", "flat", "cdata", clev)];
+		    "edgecolor", linespec.color, "linestyle", 
+		    linespec.linestyle, "cdata", clev)];
     elseif (!ischar(z))
       h = [h; patch(ax, p(1,:), p(2,:), z * ones (1, columns (p)), "facecolor",
-		    "none", "edgecolor", "flat", "cdata", clev)];
+		    "none", "edgecolor", linespec.color, 
+		    "linestyle", linespec.linestyle, "cdata", clev)];
     else
       h = [h; patch(ax, p(1,:), p(2,:), clev * ones (1, columns (p)),
-		    "facecolor", "none", "edgecolor", "flat", "cdata", clev)];
+		    "facecolor", "none", "edgecolor", linespec.color, 
+		    "linestyle", linespec.linestyle, "cdata", clev)];
     endif
     i1 += clen+1;
   endwhile
--- a/scripts/plot/__go_draw_axes__.m	Fri Dec 14 17:32:25 2007 +0000
+++ b/scripts/plot/__go_draw_axes__.m	Fri Dec 14 17:43:34 2007 +0000
@@ -666,13 +666,13 @@
 	     if (isfield (obj, "linestyle"))
 	       switch (obj.linestyle)
 		 case "-"
-		   lt = "1";
+		   lt = "lt 1";
 		 case "--"
-		   lt = "2";
+		   lt = "lt 2";
 		 case ":"
-		   lt = "3";
+		   lt = "lt 3";
 		 case "-."
-		   lt = "6";
+		   lt = "lt 6";
 		 case "none"
 		   lt = "";
 		 otherwise
@@ -756,8 +756,8 @@
 		 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
 				      round (255*color));
 	       endif
-	       withclause{data_idx} = sprintf ("with %s %s %s %s",
-					       style, pt, ps, colorspec);
+	       withclause{data_idx} = sprintf ("with %s %s %s %s %s",
+					       style, pt, lt, ps, colorspec);
 	     else
 	       if (isequal (color, [0,0,0]))
 		 typ = -1;
--- a/scripts/plot/contour.m	Fri Dec 14 17:32:25 2007 +0000
+++ b/scripts/plot/contour.m	Fri Dec 14 17:43:34 2007 +0000
@@ -18,11 +18,12 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {@var{c} =} contour (@var{z})
-## @deftypefnx {Function File} {@var{c} =} contour (@var{z}, @var{vn})
-## @deftypefnx {Function File} {@var{c} =} contour (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {@var{c} =} contour (@var{x}, @var{y}, @var{z}, @var{vn})
-## @deftypefnx {Function File} {@var{c} =} contour (@var{h}, @dots{})
+## @deftypefn {Function File} {} contour (@var{z})
+## @deftypefnx {Function File} {} contour (@var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour (@dots{}, @var{style})
+## @deftypefnx {Function File} {} contour (@var{h}, @dots{})
 ## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour (@dots{})
 ## Plot level curves (contour lines) of the matrix @var{z}, using the
 ## contour matrix @var{c} computed by @code{contourc} from the same
@@ -38,6 +39,10 @@
 ## @end group
 ## @end example
 ##
+## The style to use for the plot can be defined with a line style @var{style}
+## in a similar manner to the line styles used with the @code{plot} command.
+## Any markers defined by @var{style} are ignored.
+##
 ## The optional input and output argument @var{h} allows an axis handle to 
 ## be passed to @code{contour} and the handles to the contour objects to be
 ## returned.
--- a/scripts/plot/contour3.m	Fri Dec 14 17:32:25 2007 +0000
+++ b/scripts/plot/contour3.m	Fri Dec 14 17:43:34 2007 +0000
@@ -17,11 +17,12 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {@var{c} =} contour3 (@var{z})
-## @deftypefnx {Function File} {@var{c} =} contour3 (@var{z}, @var{vn})
-## @deftypefnx {Function File} {@var{c} =} contour3 (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {@var{c} =} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
-## @deftypefnx {Function File} {@var{c} =} contour3 (@var{h}, @dots{})
+## @deftypefn {Function File} {} contour3 (@var{z})
+## @deftypefnx {Function File} {} contour3 (@var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour3 (@dots{}, @var{style})
+## @deftypefnx {Function File} {} contour3 (@var{h}, @dots{})
 ## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{})
 ## Plot level curves (contour lines) of the matrix @var{z}, using the
 ## contour matrix @var{c} computed by @code{contourc} from the same
@@ -38,6 +39,10 @@
 ## @end group
 ## @end example
 ##
+## The style to use for the plot can be defined with a line style @var{style}
+## in a similar manner to the line styles used with the @code{plot} command.
+## Any markers defined by @var{style} are ignored.
+##
 ## The optional input and output argument @var{h} allows an axis handle to 
 ## be passed to @code{contour} and the handles to the contour objects to be
 ## returned.
--- a/src/graphics.cc	Fri Dec 14 17:32:25 2007 +0000
+++ b/src/graphics.cc	Fri Dec 14 17:43:34 2007 +0000
@@ -2705,7 +2705,7 @@
     retval = facecolor;
   else if (name.compare ("facealpha"))
     retval = facealpha;
-  else if (name.compare ("egdecolor"))
+  else if (name.compare ("edgecolor"))
     retval = edgecolor;
   else if (name.compare ("linestyle"))
     retval = linestyle;