changeset 8257:79c874fe5100

More plot object updates
author David Bateman <dbateman@free.fr>
date Wed, 22 Oct 2008 04:30:17 +0100
parents dba0037e6602
children 2b408bbd8904
files doc/interpreter/plot.txi scripts/ChangeLog scripts/plot/Makefile.in scripts/plot/__add_datasource__.m scripts/plot/__add_line_series__.m scripts/plot/__plt2mm__.m scripts/plot/__plt2mv__.m scripts/plot/__plt2ss__.m scripts/plot/__plt2sv__.m scripts/plot/__plt2vm__.m scripts/plot/__plt2vs__.m scripts/plot/__plt2vv__.m scripts/plot/__scatter__.m scripts/plot/legend.m scripts/plot/plot3.m scripts/plot/refreshdata.m src/ChangeLog src/graphics.h.in
diffstat 18 files changed, 295 insertions(+), 236 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/plot.txi	Wed Oct 22 04:16:36 2008 +0100
+++ b/doc/interpreter/plot.txi	Wed Oct 22 04:30:17 2008 +0100
@@ -1716,33 +1716,28 @@
 @cindex series objects
 @cindex line series
 
-line series objects are created by the @code{plot}  and @code{plot3}
-functions. Each @code{hggroup} element of the series contains a single
-line object as a child representing the stair. The properties of the
-line series are a one-to-one reflection of the children line object, and
-so the line series is only useful for its ability to add data sources to
-the group object.
-
-The properties of the line series are
+Line series objects are created by the @code{plot}  and @code{plot3}
+functions and are of the type @code{line}. The properties of the
+line series with the ability to add data sources.
 
 @table @code
 @item color
-The RGB color or color name of the line objects of the stairs. @xref{Colors}.
+The RGB color or color name of the line objects. @xref{Colors}.
 
 @item linewidth
 @itemx linestyle
-The line width and style of the line objects of the stairs. @xref{Line Styles}.
+The line width and style of the line objects. @xref{Line Styles}.
 
 @item marker
 @itemx markeredgecolor
 @itemx markerfacecolor
 @itemx markersize
-The line and fill color of the markers on the stairs. @xref{Colors}.
+The line and fill color of the markers. @xref{Colors}.
 
 @item xdata
 @itemx ydata
 @itemx zdata
-The original x, y and z data of the stairs.
+The original x, y and z data.
 
 @item xdatasource
 @itemx ydatasource
@@ -1813,7 +1808,40 @@
 @cindex group objects
 @cindex scatter group
 
-TO BE WRITTEN
+Scatter series objects are created by the @code{scatter} or @code{scatter3}
+functions. A single hggroup element contains as many children as there are
+points in the scatter plot, with each child representing one of the points.
+The properties of the stem series are
+
+@table @code
+@item linewidth
+The line width of the line objects of the points. @xref{Line Styles}.
+
+@item marker
+@itemx markeredgecolor
+@itemx markerfacecolor
+The line and fill color of the markers of the points. @xref{Colors}.
+
+@item xdata
+@itemx ydata
+@itemx zdata
+The original x, y and z data of the stems.
+
+@item cdata
+The color data for the points of the plot. Each point can have a separate
+color, or a unique color can be specified.
+
+@item sizedata
+The size data for the points of the plot. Each point can its own size or a 
+unique size can be specified.
+
+@item xdatasource
+@itemx ydatasource
+@itemx zdatasource
+@itemx cdatasource
+@itemx sizedatasource
+Data source variables.
+@end table
 
 @node Stair group
 @subsubsection Stair group
@@ -1852,14 +1880,88 @@
 @cindex series objects
 @cindex stem series
 
-TO BE WRITTEN
+Stem series objects are created by the @code{stem} or @code{stem3}
+functions. Each @code{hgrroup} element contains a single line object
+as a child respresenting the stems. The properties of the stem series
+are
+
+@table @code
+@item showbaseline
+@itemx baseline
+@itemx basevalue
+The property @code{showbaseline} flags whether the baseline of the
+stem series is displayed (default is "on"). The handle of the graphics
+object representing the baseline is given by the @code{baseline}
+property and the y-value (or z-value for @code{stem3}) of the baseline
+by the @code{basevalue} property.
+
+Changes to any of these property are propagated to the other members of
+the stem series and to the baseline itself. Equally changes in the
+properties of the base line itself are propagated to the members of the
+corresponding stem series.
+
+@item color
+The RGB color or color name of the line objects of the stems. @xref{Colors}.
+
+@item linewidth
+@itemx linestyle
+The line width and style of the line objects of the stems. @xref{Line Styles}.
+
+@item marker
+@itemx markeredgecolor
+@itemx markerfacecolor
+@itemx markersize
+The line and fill color of the markers on the stems. @xref{Colors}.
+
+@item xdata
+@itemx ydata
+@itemx zdata
+The original x, y and z data of the stems.
+
+@item xdatasource
+@itemx ydatasource
+@itemx zdatasource
+Data source variables.
+@end table
 
 @node Surface group
 @subsubsection Surface group
 @cindex group objects
 @cindex surface group
 
-TO BE WRITTEN
+Surface group objects are created by the @code{surf} or @code{mesh}
+functions, but are equally one of the handles returned by the @code{surfc}
+or @code{meshc} functions. The surface group is of the type @code{surface}.
+
+The properties of the surface group are
+
+@table @code
+@item edgecolor
+@item facecolor
+The RGB color or color name of the edges or faces of the surface. @xref{Colors}.
+
+@item linewidth
+@itemx linestyle
+The line width and style of the lines on the surface. @xref{Line Styles}.
+
+@item marker
+@itemx markeredgecolor
+@itemx markerfacecolor
+@itemx markersize
+The line and fill color of the markers on the surface. @xref{Colors}.
+
+@item xdata
+@itemx ydata
+@itemx zdata
+@item cdata
+The original x, y, z and c data.
+
+@item xdatasource
+@itemx ydatasource
+@itemx zdatasource
+@itemx cdatasource
+Data source variables.
+@end table
 
 @node Graphics backends
 @subsection Graphics backends
--- a/scripts/ChangeLog	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/ChangeLog	Wed Oct 22 04:30:17 2008 +0100
@@ -1,3 +1,16 @@
+2008-10-22  David Bateman  <dbateman@free.fr>
+
+	* plot/__add_line_series__.m: Remove
+	* plot/Makefile.in (SOURCES): Remove it here too.
+	* plot/__add_datasource__.m: Allow for more than one character in
+	source name.
+	* plot/refreshdata.m: Ditto.
+	* plot/__plt2mm__.m, plot/__plt2mv__.m, plot/__plt2ss__.m, 
+	plot/__plt2sv__.m, plot/__plt2vm__.m, plot/__plt2vv__.m, 
+	plot/__plt2vs__.m, plot3.m: Remove previous line series changes.
+	* plot/__scatter__.m: Add scatter series objects and data sources.
+	* plot/legend.m: Update type in loop and remove debugging messages.
+	
 2008-10-21  Ben Abbott  <bpabbott@mac.com>
 
 	* specfun/legendre.m: Warn once on under/overflow.
--- a/scripts/plot/Makefile.in	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/Makefile.in	Wed Oct 22 04:30:17 2008 +0100
@@ -35,7 +35,6 @@
 
 SOURCES = \
   __add_datasource__.m \
-  __add_line_series__.m \
   __area__.m \
   __axes_limits__.m \
   __axis_label__.m \
--- a/scripts/plot/__add_datasource__.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/__add_datasource__.m	Wed Oct 22 04:30:17 2008 +0100
@@ -37,7 +37,7 @@
   while (i < numel (varargin))
     arg = varargin{++i};
     if (i != numel(varargin) && ischar (arg)
-	&& length (arg) > 1 && strcmpi (arg(2:end), "datasource"))
+	&& length (arg) > 1 && strcmpi (arg(end-9:end), "datasource"))
       arg = tolower (arg);
       val = varargin{++i};
       if (ischar (val))
--- a/scripts/plot/__add_line_series__.m	Wed Oct 22 04:16:36 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-## Copyright (C) 2008 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## Undocumented internal function
-
-function  __add_line_series__ (h, hg)
-
-  obj = get(h);
-
-  addproperty ("color", hg, "linecolor", obj.color);
-  addproperty ("linewidth", hg, "linelinewidth", obj.linewidth);
-  addproperty ("linestyle", hg, "linelinestyle", obj.linestyle);
-  addproperty ("marker", hg, "linemarker", obj.marker);
-  addproperty ("markeredgecolor", hg, "linemarkerfacecolor", 
-	       obj.markeredgecolor);
-  addproperty ("markerfacecolor", hg, "linemarkerfacecolor", 
-	       obj.markerfacecolor);
-  addproperty ("markersize", hg, "linemarkersize", obj.markersize);
-      
-  addlistener (hg, "color", @update_props);
-  addlistener (hg, "linewidth", @update_props); 
-  addlistener (hg, "linestyle", @update_props); 
-  addlistener (hg, "marker", @update_props); 
-  addlistener (hg, "markeredgecolor", @update_props); 
-  addlistener (hg, "markerfacecolor", @update_props); 
-  addlistener (hg, "markersize", @update_props);
-
-  addproperty ("xdata", hg, "data", obj.xdata);
-  addproperty ("ydata", hg, "data", obj.ydata);
-  addproperty ("zdata", hg, "data", obj.zdata);
-
-  addlistener (hg, "xdata", @update_props);
-  addlistener (hg, "ydata", @update_props);
-  addlistener (hg, "zdata", @update_props);
-endfunction
-
-function update_props (h, d)
-  set (get (h, "children"), "color", get (h, "color"), 
-       "linewidth", get (h, "linewidth"),
-       "linestyle", get (h, "linestyle"),
-       "marker", get (h, "marker"),
-       "markerfacecolor", get (h, "markerfacecolor"),
-       "markeredgecolor", get (h, "markeredgecolor"),
-       "markersize", get (h, "markersize"),
-       "xdata", get (h, "xdata"),
-       "ydata", get (h, "ydata"),
-       "zdata", get (h, "zdata"));
-endfunction
-
--- a/scripts/plot/__plt2mm__.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/__plt2mm__.m	Wed Oct 22 04:30:17 2008 +0100
@@ -55,19 +55,9 @@
 	  color = __next_line_color__ ();
 	endif
 
-	hg = hggroup ();
-	retval(i) = hg;
-	args = __add_datasource__ ("__plt2mm__", hg, {"x", "y", "z"}, 
-				   properties{:});
-
-	h = line (x(:,i), y(:,i), "keylabel", tkey, "color", color,
-		  "linestyle", options(i).linestyle,
-		  "marker", options(i).marker, "parent", hg);
-
-	__add_line_series__ (h, hg);
-	if (! isempty( args))
-	  set (hg, args {:});
-	endif
+	retval(i) = line (x(:,i), y(:,i), "keylabel", tkey, "color", color,
+			  "linestyle", options(i).linestyle,
+			  "marker", options(i).marker, properties{:});
       endfor
     else
       error ("__plt2mm__: arguments must be a matrices");
--- a/scripts/plot/__plt2mv__.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/__plt2mv__.m	Wed Oct 22 04:30:17 2008 +0100
@@ -71,19 +71,9 @@
 	color = __next_line_color__ ();
       endif
 
-      hg = hggroup ();
-      retval(i) = hg;
-      args = __add_datasource__ ("__plt2mv__", hg, {"x", "y", "z"}, 
-				 properties{:});
-
-      h = line (x(:,i), y, "keylabel", tkey, "color", color,
-		"linestyle", options(i).linestyle,
-		"marker", options(i).marker, "parent", hg);
-   
-      __add_line_series__ (h, hg);
-      if (! isempty (args))
-        set (hg, args{:});
-      endif
+      retval(i) = line (x(:,i), y, "keylabel", tkey, "color", color,
+			"linestyle", options(i).linestyle,
+			"marker", options(i).marker, properties{:});
     endfor
   else
     error ("__plt2mv__: arguments must be a matrices");
--- a/scripts/plot/__plt2ss__.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/__plt2ss__.m	Wed Oct 22 04:30:17 2008 +0100
@@ -52,19 +52,9 @@
       color = __next_line_color__ ();
     endif
 
-    hg = hggroup ();
-    retval = hg;
-    properties = __add_datasource__ ("__plt2ss__", hg, {"x", "y", "z"}, 
-				     properties{:});
-
-    h = line (x, y, "keylabel", key, "color", color,
-	      "linestyle", options.linestyle,
-	      "marker", options.marker, "parent", hg);
-
-    __add_line_series__ (h, hg);
-    if (! isempty (properties))
-      set (hg, properties{:});
-    endif
+    retval = line (x, y, "keylabel", key, "color", color,
+		   "linestyle", options.linestyle,
+		   "marker", options.marker, properties{:});
   else
     error ("__plt2ss__: arguments must be scalars");
   endif
--- a/scripts/plot/__plt2sv__.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/__plt2sv__.m	Wed Oct 22 04:30:17 2008 +0100
@@ -51,19 +51,9 @@
 	color = __next_line_color__ ();
       endif
 
-      hg = hggroup ();
-      retval(i) = hg;
-      args = __add_datasource__ ("__plt2sv__", hg, {"x", "y", "z"}, 
-				 properties{:});
-
-      h = line (x, y(i), "keylabel", tkey, "color", color,
-		"linestyle", options(i).linestyle,
-		"marker", options(i).marker, "parent", hg);
-
-      __add_line_series__ (h, hg);
-      if (! isempty(args))
-        set (hg, args{:});
-      endif
+      retval(i) = line (x, y(i), "keylabel", tkey, "color", color,
+			"linestyle", options(i).linestyle,
+			"marker", options(i).marker, properties{:});
     endfor
   else
     error ("__plt2sv__: first arg must be scalar, second arg must be vector");
--- a/scripts/plot/__plt2vm__.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/__plt2vm__.m	Wed Oct 22 04:30:17 2008 +0100
@@ -71,19 +71,9 @@
 	color = __next_line_color__ ();
       endif
 
-      hg = hggroup ();
-      retval(i) = hg;
-      args = __add_datasource__ ("__plt2vm__", hg, {"x", "y", "z"}, 
-				 properties{:});
-
-      h = line (x, y(:,i), "keylabel", tkey, "color", color,
-		"linestyle", options(i).linestyle,
-		"marker", options(i).marker, "parent", hg);
-
-      __add_line_series__ (h, hg);
-      if (! isempty (args))
-        set (hg, args{:});
-      endif
+      retval(i) = line (x, y(:,i), "keylabel", tkey, "color", color,
+			"linestyle", options(i).linestyle,
+			"marker", options(i).marker, properties{:});
     endfor
   else
     error ("__plt2vm__: arguments must be a matrices");
--- a/scripts/plot/__plt2vs__.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/__plt2vs__.m	Wed Oct 22 04:30:17 2008 +0100
@@ -51,19 +51,9 @@
 	color = __next_line_color__ ();
       endif
 
-      hg = hggroup ();
-      retval(i) = hg;
-      args = __add_datasource__ ("__plt2vs__", hg, {"x", "y", "z"}, 
-				 properties{:});
-
-      h = line (x(i), y, "keylabel", tkey, "color", color,
-		"linestyle", options(i).linestyle,
-		"marker", options(i).marker, "parent", hg);
-
-      __add_line_series__ (h, hg);
-      if (! isempty (args))
-        set (hg, args{:});
-      endif
+      retval(i) = line (x(i), y, "keylabel", tkey, "color", color,
+			"linestyle", options(i).linestyle,
+			"marker", options(i).marker, properties{:});
     endfor
   else
     error ("__plt2vs__: first arg must be vector, second arg must be scalar");
--- a/scripts/plot/__plt2vv__.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/__plt2vv__.m	Wed Oct 22 04:30:17 2008 +0100
@@ -66,19 +66,9 @@
       color = __next_line_color__ ();
     endif
 
-    hg = hggroup ();
-    retval = hg;
-    properties = __add_datasource__ ("__plt2vv__", hg, {"x", "y", "z"}, 
-				     properties{:});
-
-    h = line (x, y, "keylabel", key, "color", color,
+    retval = line (x, y, "keylabel", key, "color", color,
 	      "linestyle", options.linestyle,
-	      "marker", options.marker, "parent", hg);
-
-    __add_line_series__ (h, hg);
-    if (! isempty (properties))
-      set (hg, properties{:});
-    endif
+	      "marker", options.marker, properties{:});
   else
     error ("__plt2vv__: vector lengths must match");
   endif
--- a/scripts/plot/__scatter__.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/__scatter__.m	Wed Oct 22 04:30:17 2008 +0100
@@ -18,7 +18,7 @@
 
 ## Undocumented internal function.
 
-function h = __scatter__ (varargin)
+function hg = __scatter__ (varargin)
 
   h = varargin{1};
   nd = varargin{2};
@@ -57,17 +57,27 @@
   else
     s = 6;
   endif
+  if (numel (s) == 1)
+    ss = s;
+    s = repmat (s, numel(x), 1);
+  endif
 
   if (istart < nargin && firstnonnumeric > istart + 1)
     c = varargin{istart + 1};
     if (isvector (c))
-      c = c(:);
+      if (columns (c) == 3)
+	cc = c;
+	c = repmat (c, numel(x), 1);
+      else
+	c = c(:);
+      endif
     endif
   elseif (firstnonnumeric == istart + 1 && ischar (varargin{istart + 1}))
     c = varargin{istart + 1};
     firstnonnumeric++;
   else
-    c = 1 : length(x);
+    cc = __next_line_color__();
+    c = repmat (cc, numel(x), 1);
   endif
 
   newargs = {};
@@ -80,7 +90,7 @@
     if (ischar (arg) && strncmpi (arg, "filled", 6))
       filled = true;
     elseif ((ischar (arg) || iscell (arg)) && ! have_marker)
-      [linespec, valid] = __pltopt__ ("scatter", arg, false);
+      [linespec, valid] = __pltopt__ (fcn, arg, false);
       if (valid)
 	have_marker = true;
 	marker = linespec.marker;
@@ -88,7 +98,7 @@
 	  marker = "o";
 	endif
       else
-	error ("scatter: invalid linespec");
+	error ("%s: invalid linespec", fcn);
       endif
     else
       newargs{end+1} = arg;
@@ -98,21 +108,51 @@
     endif
   endwhile
 
-  if (ischar (c))
-    h = patch ("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor",
-	       "none", "edgecolor", c, "marker", marker, 
-	       "markersize", s, "linestyle", "none");
-    if (filled)
-      set(h, "markerfacecolor", c); 
-    endif
+  hg = hggroup ();
+  newargs = __add_datasource__ (fcn, hg, {"x", "y", "z", "c", "size"}, 
+			     newargs{:});
+
+  addproperty ("xdata", hg, "data", x);
+  addproperty ("ydata", hg, "data", y);
+  addproperty ("zdata", hg, "data", z);
+  if (exist ("cc", "var"))
+    addproperty ("cdata", hg, "data", cc);
+  else
+    addproperty ("cdata", hg, "data", c);
+  endif
+  if (exist ("ss", "var"))
+    addproperty ("sizedata", hg, "data", ss);
   else
-    h = patch ("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor",
-	       "none", "edgecolor", "flat", "cdata", c, "marker", marker, 
-	       "markersize", s, "linestyle", "none");
-    if (filled)
-      set(h, "markerfacecolor", "flat"); 
-    endif
-    ax = get (h, "parent");
+    addproperty ("sizedata", hg, "data", s);
+  endif
+  addlistener (hg, "xdata", @update_data);
+  addlistener (hg, "ydata", @update_data);
+  addlistener (hg, "zdata", @update_data);
+  addlistener (hg, "cdata", @update_data);
+  addlistener (hg, "sizedata", @update_data);
+
+  if (ischar (c))
+    for i = 1 : numel (x)
+      h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+			"faces", 1, "vertices", [x(i), y(i), z(i,:)], 
+			"facecolor", "none", "edgecolor", c, "marker", marker, 
+			"markersize", s(i), "linestyle", "none");
+      if (filled)
+	set(h, "markerfacecolor", c); 
+      endif
+    endfor
+  else
+    for i = 1 : numel (x)
+      h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+			"faces", 1, "vertices", [x(i), y(i), z(i,:)], 
+			"facecolor", "none", "edgecolor", "flat", 
+			"cdata", c(i), "marker", marker, "markersize", s(i), 
+			"linestyle", "none");
+      if (filled)
+	set(h, "markerfacecolor", "flat"); 
+      endif
+    endfor
+    ax = get (hg, "parent");
     clim = get (ax, "clim");
     if (min(c(:)) < clim(1))
       clim(1) = min(c(:));
@@ -123,4 +163,63 @@
     endif
   endif
 
+  addproperty ("linewidth", hg, "patchlinewidth", 0.5);
+  addproperty ("marker", hg, "patchmarker", marker);
+  if (numel (x) > 0)
+    addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", "none");
+    addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "none");
+  else
+    addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", 
+		 get (h, "markerfacecolor"));
+    addproperty ("markeredgecolor", hg, "patchmarkeredgecolor",
+		 get (h, "edgecolor"));
+  endif
+  addlistener (hg, "linewidth", @update_props); 
+  addlistener (hg, "marker", @update_props); 
+  addlistener (hg, "markerfacecolor", @update_props); 
+  addlistener (hg, "markeredgecolor", @update_props);
+
+  if (! isempty (newargs))
+    set (hg, newargs{:})
+  endif
+
 endfunction
+
+function update_props (h, d)
+  lw = get (h, "linewidth");
+  m = get (h, "marker");
+  fc = get (h, "markerfacecolor");
+  ec = get (h, "markeredgecolor");
+  kids = get (h, "children");
+
+  for i = 1 : numel (kids)
+    set (kids (i), "linewidth", lw, "marker", m, "markerfacecolor", fc, 
+	 "edgecolor", ec)
+  endfor
+endfunction
+
+function update_data (h, d)
+  x1 = get (h, "xdata");
+  y1 = get (h, "ydata");
+  z1 = get (h, "zdata");
+  c1 = get (h, "cdata");
+  if (!ischar (c1) && rows (c1) == 1)
+    c1 = repmat (c1, numel (x1), 1);
+  endif
+  size1 = get (h, "sizedata");
+  if (numel (size1) == 1)
+    size1 = repmat (size1, numel (x1), 1);
+  endif
+  hlist = get (h, "children");
+  if (ischar (c1))
+    for i = 1 : length (hlist)
+      set (hlist(i), "vertices", [x1(i), y1(i), y2(i)], "cdata", c1,
+	   "markersize", size1(i));
+    endfor
+  else
+    for i = 1 : length (hlist)
+      set (hlist(i), "vertices", [x1(i), y1(i), y2(i)], "cdata", c1(i,:),
+	   "markersize", size1(i));
+    endfor
+  endif
+endfunction
--- a/scripts/plot/legend.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/legend.m	Wed Oct 22 04:30:17 2008 +0100
@@ -135,6 +135,7 @@
 	    while (k <= nkids && ! strcmp (typ, "line") &&
 		   ! strcmp (typ, "hggroup"))
 	      k++;
+	      typ = get (kids (k), "type");
 	    endwhile
 	    if (k <= nkids)
 	      turn_on_legend = true;
@@ -214,9 +215,6 @@
 	warning ("legend: ignoring extra labels");
       endif
     else
-      arg
-      get(kids(k),"type")
-      k
       error ("legend: expecting argument to be a character string");
     endif
   endfor
--- a/scripts/plot/plot3.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/plot3.m	Wed Oct 22 04:30:17 2008 +0100
@@ -182,20 +182,10 @@
 	  color = __next_line_color__ ();
 	endif
 
-	hg = hggroup ();
-	tmp(++idx) = hg;
-	properties = __add_datasource__ ("plot3", hg, {"x", "y", "z"}, properties{:});
-
-	hline = line (x(:, i), y(:, i), z(:, i),  "keylabel", key,
-		      "color", color,
-		      "linestyle", options.linestyle,
-		      "marker", options.marker, "parent", hg);
-
-	__add_line_series__ (hline, hg);
-
-	if (! isempty (properties))
-	  set (hg, properties{:});
-	endif
+	tmp(++idx) = line (x(:, i), y(:, i), z(:, i),  "keylabel", key,
+			   "color", color,
+			   "linestyle", options.linestyle,
+			   "marker", options.marker, properties{:});
       endfor
 
       x_set = 0;
@@ -241,20 +231,10 @@
 	  color = __next_line_color__ ();
 	endif
 
-	hg = hggroup ();
-	tmp(++idx) = hg;
-	properties = __add_datasource__ ("plot3", hg, {"x", "y", "z"}, properties{:});
-
-	hline = line (x(:, i), y(:, i), z(:, i),  "keylabel", key,
-		      "color", color,
-		      "linestyle", options.linestyle,
-		      "marker", options.marker, "parent", hg);
-
-	__add_line_series__ (hline, hg);
-
-	if (! isempty (properties))
-	  set (hg, properties{:});
-	endif
+	tmp(++idx) = line (x(:, i), y(:, i), z(:, i),  "keylabel", key,
+			   "color", color,
+			   "linestyle", options.linestyle,
+			   "marker", options.marker, properties{:});
       endfor
 
       x = new;
@@ -319,20 +299,10 @@
 	color = __next_line_color__ ();
       endif
 
-      hg = hggroup ();
-      tmp(++idx) = hg;
-      properties = __add_datasource__ ("plot3", hg, {"x", "y", "z"}, properties{:});
-
-      hline = line (x(:, i), y(:, i), z(:, i),  "keylabel", key, 
-		    "color", color,
-		    "linestyle", options.linestyle,
-		    "marker", options.marker, "parent", hg);
-
-      __add_line_series__ (hline, hg);
-
-      if (! isempty (properties))
-	set (hg, properties{:});
-      endif
+      tmp(++idx) = line (x(:, i), y(:, i), z(:, i),  "keylabel", key, 
+			 "color", color,
+			 "linestyle", options.linestyle,
+			 "marker", options.marker, properties{:});
     endfor
   endif
 
--- a/scripts/plot/refreshdata.m	Wed Oct 22 04:16:36 2008 +0100
+++ b/scripts/plot/refreshdata.m	Wed Oct 22 04:30:17 2008 +0100
@@ -74,7 +74,7 @@
   for i = 1 : numel (h)
     obj = get (h (i));
     fldnames = fieldnames (obj);
-    m = regexpi (fieldnames(obj), "^.datasource$", "match");
+    m = regexpi (fieldnames(obj), "^.+datasource$", "match");
     idx = cellfun (@(x) !isempty(x), m);
     if (any (idx))
       props = [props; {cell2mat(m(idx))}];
--- a/src/ChangeLog	Wed Oct 22 04:16:36 2008 +0100
+++ b/src/ChangeLog	Wed Oct 22 04:30:17 2008 +0100
@@ -1,3 +1,8 @@
+2008-10-22  David Bateman  <dbateman@free.fr>
+
+	* graphics.h.in (line::properties, surface::properties): Add data
+	source properties.
+
 2008-10-21  John W. Eaton  <jwe@octave.org>
 
 	* graphics.h.in (axes::properties::delete_children): Delete decl.
--- a/src/graphics.h.in	Wed Oct 22 04:16:36 2008 +0100
+++ b/src/graphics.h.in	Wed Oct 22 04:30:17 2008 +0100
@@ -2825,6 +2825,9 @@
       row_vector_property udata u , Matrix ()
       row_vector_property xldata u , Matrix ()
       row_vector_property xudata u , Matrix ()
+      string_property xdatasource , ""
+      string_property ydatasource , ""
+      string_property zdatasource , ""
       color_property color , color_values (0, 0, 0)
       radio_property linestyle , "{-}|--|:|-.|none"
       double_property linewidth , 0.5
@@ -3201,6 +3204,10 @@
       array_property zdata u , Matrix ()
       array_property cdata u , Matrix ()
       radio_property cdatamapping al , "{scaled}|direct"
+      string_property xdatasource , ""
+      string_property ydatasource , ""
+      string_property zdatasource , ""
+      string_property cdatasource , ""
       color_property facecolor , "{flat}|none|interp|texturemap"
       double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp"))
       color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("flat|none|interp"))