changeset 10697:1215ab6f3491

Honor Matlab color settings for scatter().
author Ben Abbott <bpabbott@mac.com>
date Thu, 10 Jun 2010 19:16:56 -0400
parents e363b09a30c0
children fa00ccf7b1f9
files scripts/ChangeLog scripts/plot/private/__scatter__.m scripts/plot/scatter.m
diffstat 3 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,5 +1,7 @@
 2010-06-10  Ben Abbott <bpabbott@mac.com>
 
+	* plot/private/__scatter__.m, plot/scatter.m: Honor Matlab color
+	settings.
 	* general/prepad.m: Fix typo 'dimm' -> 'dim'.
 
 2010-06-10  Jaroslav Hajek  <highegg@gmail.com>
--- a/scripts/plot/private/__scatter__.m
+++ b/scripts/plot/private/__scatter__.m
@@ -54,22 +54,24 @@
 
   if (istart <= nargin)
     s = varargin{istart};
-    if (isempty (s))
+    if (isempty (s) || ischar (s))
       s = 6;
+    else
+      istart++;
     endif
   else
     s = 6;
   endif
 
-  if (istart < nargin && firstnonnumeric > istart + 1)
-    c = varargin{istart + 1};
+  if (istart <= nargin && firstnonnumeric > istart)
+    c = varargin{istart};
     if (isvector (c))
       if (columns (c) != 3)
         c = c(:);
       endif
     endif
-  elseif (firstnonnumeric == istart + 1 && ischar (varargin{istart + 1}))
-    c = varargin{istart + 1};
+  elseif (firstnonnumeric == istart && ischar (varargin{istart}))
+    c = varargin{istart};
     firstnonnumeric++;
   else
     c = [];
@@ -143,7 +145,7 @@
                             "faces", 1, "vertices", [x(i), y(i), z(i,:)], 
                             "facecolor", "none", "edgecolor", "none", 
                             "marker", marker,  "markersize", s(i), 
-                            "markeredgecolor", none, "markerfacecolor", c,
+                            "markeredgecolor", c, "markerfacecolor", c,
                             "linestyle", "none");
         else
           h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
--- a/scripts/plot/scatter.m
+++ b/scripts/plot/scatter.m
@@ -80,4 +80,16 @@
 %!demo
 %! x = randn (100, 1);
 %! y = randn (100, 1);
+%! scatter (x, y, "r")
+
+%!demo
+%! x = randn (100, 1);
+%! y = randn (100, 1);
 %! scatter (x, y, [], sqrt(x.^2 + y.^2));
+
+%!demo
+%! x = rand (10, 1);
+%! y = rand (10, 1);
+%! s = 10 - 10 * log (x.^2+y.^2);
+%! h = scatter (x, y, s, s, "s", "filled");
+