Mercurial > octave-nkf
diff scripts/plot/__contour__.m @ 12068:6624d0ac6a52 release-3-2-x
Fix test for setting of datasource properties. Add the edgecolor property to contours
author | David Bateman <dbateman@free.fr> |
---|---|
date | Mon, 24 Aug 2009 10:02:47 +0200 |
parents | eb63fbe60fab |
children |
line wrap: on
line diff
--- a/scripts/plot/__contour__.m Sun Aug 23 11:12:35 2009 +0200 +++ b/scripts/plot/__contour__.m Mon Aug 24 10:02:47 2009 +0200 @@ -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