changeset 13988:7ab497513c1a

Fix colour properties in scatter (bug #34936) * __scatter_.m (render_size_color): Don't flatten c into a vector. * scatter.m: Add another useful demo.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Sun, 04 Dec 2011 11:01:19 -0500
parents 2c0765c14e4f
children b4d399c975de
files scripts/plot/private/__scatter__.m scripts/plot/scatter.m
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/private/__scatter__.m	Sun Dec 04 03:35:25 2011 -0500
+++ b/scripts/plot/private/__scatter__.m	Sun Dec 04 11:01:19 2011 -0500
@@ -286,7 +286,7 @@
                           "marker", marker, "markersize", s,
                           "markeredgecolor", "none",
                           "markerfacecolor", "flat",
-                          "cdata", c, "facevertexcdata", c(:),
+                          "cdata", c, "facevertexcdata", c,
                           "linestyle", "none");
       else
         h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
@@ -295,7 +295,7 @@
                           "marker", marker, "markersize", s,
                           "markeredgecolor", "flat",
                           "markerfacecolor", "none",
-                          "cdata", c, "facevertexcdata", c(:),
+                          "cdata", c, "facevertexcdata", c,
                           "linestyle", "none");
       endif
     endif
--- a/scripts/plot/scatter.m	Sun Dec 04 03:35:25 2011 -0500
+++ b/scripts/plot/scatter.m	Sun Dec 04 11:01:19 2011 -0500
@@ -115,3 +115,10 @@
 %! s = 10 - 10*log (x.^2 + y.^2);
 %! h = scatter (x, y, [], "r", "s");
 
+%!demo
+%! n = 500;
+%! x = rand(n,1);
+%! y = rand(n,1);
+%! idx = ceil(rand(n,1)*3);
+%! colors = eye(3)(idx, :);
+%! scatter(x,y,15, colors, "filled")
\ No newline at end of file