diff scripts/plot/private/__scatter__.m @ 10083:614ad9e7a17b

use patches again in scatter plots
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 11 Jan 2010 22:06:19 +0100
parents 28af9aa6f9ed
children 4516a0c97ced
line wrap: on
line diff
--- a/scripts/plot/private/__scatter__.m
+++ b/scripts/plot/private/__scatter__.m
@@ -120,7 +120,7 @@
   addlistener (hg, "cdata", @update_data);
   addlistener (hg, "sizedata", @update_data);
 
-  if (numel (x) <= 20)
+  if (numel (x) <= 100)
 
     ## For small number of points, we'll construct an object for each point.
 
@@ -130,9 +130,10 @@
 
     if (ischar (c))
       for i = 1 : numel (x)
-        h = __go_line__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                         "color", c, "marker", marker, 
-                         "markersize", s(i), "linestyle", "none");
+        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
@@ -143,11 +144,14 @@
       endif
 
       for i = 1 : numel (x)
-        h = __go_line__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                         "color", c(i,:), "marker", marker, 
-                         "markersize", s(i), "linestyle", "none");
+        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", c(i,:)); 
+          set(h, "markerfacecolor", "flat"); 
         endif
       endfor
     endif
@@ -236,11 +240,24 @@
     x = vert(:,1);
     y = vert(:,2);
     z = vert(:,3:end);
-    h = __go_line__ (hg, "xdata", x, "ydata", y, "zdata", z,
-                     "color", c, "marker", marker, 
-                     "markersize", s, "linestyle", "none");
-    if (filled)
-      set(h, "markerfacecolor", c); 
+    if (ischar (c))
+      h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                        "faces", 1, "vertices", vert, 
+                        "facecolor", "none", "edgecolor", c, "marker", marker, 
+                        "markersize", s, "linestyle", "none");
+      if (filled)
+        set(h, "markerfacecolor", c); 
+      endif
+    else
+      h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                        "faces", 1, "vertices", vert, 
+                        "facecolor", "none", "edgecolor", "flat", 
+                        "cdata", c, 
+                        "marker", marker, "markersize", s, 
+                        "linestyle", "none");
+      if (filled)
+        set(h, "markerfacecolor", "flat"); 
+      endif
     endif
   else
     ## FIXME: round the size to one decimal place. It's not quite right, though.