1.1 --- a/scripts/plot/__contour__.m Sat Mar 07 10:41:27 2009 -0500
1.2 +++ b/scripts/plot/__contour__.m Mon Aug 24 10:02:47 2009 +0200
1.3 @@ -28,6 +28,7 @@
1.4
1.5 linespec.linestyle = "-";
1.6 linespec.color = "auto";
1.7 + edgecolor = "flat";
1.8 for i = 3 : nargin
1.9 arg = varargin {i};
1.10 if ((ischar (arg) || iscell (arg)))
1.11 @@ -52,6 +53,17 @@
1.12 varargin(i:i+1) = [];
1.13 elseif (strcmpi (varargin{i}, "linecolor"))
1.14 linespec.color = varargin {i + 1};
1.15 + edgecolor = linespec.color;
1.16 + if (ischar (edgecolor) && strcmpi (edgecolor, "auto"))
1.17 + edgecolor = "flat";
1.18 + endif
1.19 + varargin(i:i+1) = [];
1.20 + elseif (strcmpi (varargin{i}, "edgecolor"))
1.21 + linespec.color = varargin {i + 1};
1.22 + edgecolor = linespec.color;
1.23 + if (ischar (edgecolor) && strcmpi (edgecolor, "flat"))
1.24 + linespec.color = "auto";
1.25 + endif
1.26 varargin(i:i+1) = [];
1.27 else
1.28 opts{end+1} = varargin{i};
1.29 @@ -164,6 +176,10 @@
1.30 addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle);
1.31 addproperty ("linewidth", hg, "linelinewidth", 0.5);
1.32
1.33 + ## FIXME It would be good to hide this property which is just an undocumented
1.34 + ## alias for linecolor
1.35 + addproperty ("edgecolor", hg, "color", edgecolor, "{flat}|none");
1.36 +
1.37 addlistener (hg, "fill", @update_data);
1.38
1.39 addlistener (hg, "zlevelmode", @update_zlevel);
1.40 @@ -185,6 +201,8 @@
1.41 addlistener (hg, "linestyle", @update_line);
1.42 addlistener (hg, "linewidth", @update_line);
1.43
1.44 + addlistener (hg, "edgecolor", @update_edgecolor);
1.45 +
1.46 add_patch_children (hg);
1.47
1.48 if (!isempty (opts))
1.49 @@ -366,11 +384,27 @@
1.50 endswitch
1.51 endfunction
1.52
1.53 +function update_edgecolor (h, d)
1.54 + ec = get (h, "edgecolor");
1.55 + lc = get (h, "linecolor");
1.56 + if (ischar (ec) && strcmpi (ec, "flat"))
1.57 + if (! strcmpi (lc, "auto"))
1.58 + set (h, "linecolor", "auto");
1.59 + endif
1.60 + elseif (! isequal (ec, lc))
1.61 + set (h, "linecolor", ec);
1.62 + endif
1.63 +endfunction
1.64 +
1.65 function update_line (h, d)
1.66 lc = get (h, "linecolor");
1.67 + ec = get (h, "edgecolor");
1.68 if (strcmpi (lc, "auto"))
1.69 lc = "flat";
1.70 endif
1.71 + if (! isequal (ec, lc))
1.72 + set (h, "edgecolor", lc);
1.73 + endif
1.74 set (findobj (h, "type", "patch"), "edgecolor", lc,
1.75 "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"));
1.76 endfunction