diff scripts/plot/__patch__.m @ 9118:308311b642b2

Explicitly set the default facecolor of patches
author David Bateman <dbateman@free.fr>
date Tue, 14 Apr 2009 21:22:24 +0200
parents 96e7a72be5e7
children
line wrap: on
line diff
--- a/scripts/plot/__patch__.m
+++ b/scripts/plot/__patch__.m
@@ -177,18 +177,23 @@
   else
     vert = args {idx};
   endif
-  idx = find (cellfun (@(x) strcmpi (x, "facecolor"), args)) + 1;
-  if (isempty(idx) || idx > nargs)
-    fc = "flat";
-  else
-    fc = args {idx};
-  endif
   idx = find (cellfun (@(x) strcmpi (x, "facevertexcdata"), args)) + 1;
   if (isempty(idx) || idx > nargs)
     fvc = [];
   else
     fvc = args {idx};
   endif
+  idx = find (cellfun (@(x) strcmpi (x, "facecolor"), args)) + 1;
+  if (isempty(idx) || idx > nargs)
+    if (!isempty (fvc))
+      fc = "flat";
+    else
+      fc = [0, 1, 0];
+    endif
+    args = {"facecolor", fc, args{:}};
+  else
+    fc = args {idx};
+  endif
 
   nr = size (faces, 2);
   nc = size (faces, 1);
@@ -247,18 +252,23 @@
   else
     z = args {idx};
   endif
-  idx = find (cellfun (@(x) strcmpi (x, "facecolor"), args)) + 1;
-  if (isempty(idx) || idx > nargs)
-    fc = "flat";
-  else
-    fc = args {idx};
-  endif
   idx = find (cellfun (@(x) strcmpi (x, "cdata"), args)) + 1;
   if (isempty(idx) || idx > nargs)
     c = [];
   else
     c = args {idx};
   endif
+  idx = find (cellfun (@(x) strcmpi (x, "facecolor"), args)) + 1;
+  if (isempty(idx) || idx > nargs)
+    if (!isempty (c))
+      fc = "flat";
+    else
+      fc = [0, 1, 0];
+    endif
+    args = {"facecolor", fc, args{:}};
+  else
+    fc = args {idx};
+  endif
 
   [nr, nc] = size (x);
   if (!isempty (z))