# HG changeset patch # User David Bateman # Date 1251100967 -7200 # Node ID 6624d0ac6a52770da69c91e4e620abc71d0ab3a9 # Parent 310063a874079095b0e3ea456863980304f6e59f Fix test for setting of datasource properties. Add the edgecolor property to contours diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,9 @@ +2009-08-22 David Bateman + + * plot/__add_datasource__.m: Correct test for "datasource" argument + * plot/__countour__.m: Add edgecolor properties and make it an alias + for linecolor with the value "auto" being "flat" for the edgecolor. + 2009-08-04 Pieter Eendebak * set/setxor.m: Support cell arrays of strings. diff --git a/scripts/plot/__add_datasource__.m b/scripts/plot/__add_datasource__.m --- a/scripts/plot/__add_datasource__.m +++ b/scripts/plot/__add_datasource__.m @@ -40,7 +40,7 @@ while (i < numel (varargin)) arg = varargin{++i}; if (i != numel(varargin) && ischar (arg) - && length (arg) > 1 && strcmpi (arg(end-9:end), "datasource")) + && length (arg) > 9 && strcmpi (arg(end-9:end), "datasource")) arg = tolower (arg); val = varargin{++i}; if (ischar (val)) diff --git a/scripts/plot/__contour__.m b/scripts/plot/__contour__.m --- a/scripts/plot/__contour__.m +++ b/scripts/plot/__contour__.m @@ -28,6 +28,7 @@ linespec.linestyle = "-"; linespec.color = "auto"; + edgecolor = "flat"; for i = 3 : nargin arg = varargin {i}; if ((ischar (arg) || iscell (arg))) @@ -52,6 +53,17 @@ varargin(i:i+1) = []; elseif (strcmpi (varargin{i}, "linecolor")) linespec.color = varargin {i + 1}; + edgecolor = linespec.color; + if (ischar (edgecolor) && strcmpi (edgecolor, "auto")) + edgecolor = "flat"; + endif + varargin(i:i+1) = []; + elseif (strcmpi (varargin{i}, "edgecolor")) + linespec.color = varargin {i + 1}; + edgecolor = linespec.color; + if (ischar (edgecolor) && strcmpi (edgecolor, "flat")) + linespec.color = "auto"; + endif varargin(i:i+1) = []; else opts{end+1} = varargin{i}; @@ -164,6 +176,10 @@ addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle); addproperty ("linewidth", hg, "linelinewidth", 0.5); + ## FIXME It would be good to hide this property which is just an undocumented + ## alias for linecolor + addproperty ("edgecolor", hg, "color", edgecolor, "{flat}|none"); + addlistener (hg, "fill", @update_data); addlistener (hg, "zlevelmode", @update_zlevel); @@ -185,6 +201,8 @@ addlistener (hg, "linestyle", @update_line); addlistener (hg, "linewidth", @update_line); + addlistener (hg, "edgecolor", @update_edgecolor); + add_patch_children (hg); if (!isempty (opts)) @@ -366,11 +384,27 @@ endswitch endfunction +function update_edgecolor (h, d) + ec = get (h, "edgecolor"); + lc = get (h, "linecolor"); + if (ischar (ec) && strcmpi (ec, "flat")) + if (! strcmpi (lc, "auto")) + set (h, "linecolor", "auto"); + endif + elseif (! isequal (ec, lc)) + set (h, "linecolor", ec); + endif +endfunction + function update_line (h, d) lc = get (h, "linecolor"); + ec = get (h, "edgecolor"); if (strcmpi (lc, "auto")) lc = "flat"; endif + if (! isequal (ec, lc)) + set (h, "edgecolor", lc); + endif set (findobj (h, "type", "patch"), "edgecolor", lc, "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle")); endfunction