changeset 17407:a5de727e3795

__scatter__.m: Fix handling of NaNs in marker size param.
author Andreas Weber <andreas.weber@hs-offenburg.de>
date Wed, 11 Sep 2013 10:32:06 +0200
parents 3611ebb0ad88
children 266fafd1ffc1
files scripts/plot/private/__scatter__.m
diffstat 1 files changed, 23 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/private/__scatter__.m	Tue Sep 10 22:00:19 2013 -0700
+++ b/scripts/plot/private/__scatter__.m	Wed Sep 11 10:32:06 2013 +0200
@@ -30,29 +30,14 @@
   y   = varargin{5}(:);
 
   if (nd == 2)
-    idx = isnan (x) | isnan (y);
-    x(idx) = [];
-    y(idx) = [];
-    z = zeros (length (x), 0);
     istart = 6;
   else
     z = varargin{6}(:);
-    idx = isnan (x) | isnan (y) | isnan (z);
-    x(idx) = [];
-    y(idx) = [];
-    z(idx) = [];
     istart = 7;
   endif
 
-  firstnonnumeric = find (! cellfun ("isnumeric", varargin(istart:nargin)), 1);
-  if (isempty (firstnonnumeric))
-    firstnonnumeric = Inf;
-  else
-    firstnonnumeric += istart - 1;
-  endif
-
   if (istart <= nargin)
-    s = varargin{istart};
+    s = varargin{istart}(:);
     if (isempty (s) || ischar (s))
       s = 6;
     endif
@@ -63,6 +48,28 @@
     s = 6;
   endif
 
+  ## Remove NaNs
+  idx = isnan (x) | isnan (y) | isnan (s);
+  if (nd == 3)
+    idx |= isnan (z);
+    z(idx) = [];
+  endif
+  x(idx) = [];
+  y(idx) = [];
+  if (nd == 2)
+    z = zeros (length (x), 0);
+  endif
+  if (numel (s) > 1)
+    s(idx) = [];
+  endif
+
+  firstnonnumeric = find (! cellfun ("isnumeric", varargin(istart:nargin)), 1);
+  if (isempty (firstnonnumeric))
+    firstnonnumeric = Inf;
+  else
+    firstnonnumeric += istart - 1;
+  endif
+
   if (istart <= nargin && firstnonnumeric > istart)
     c = varargin{istart};
     if (isvector (c) && columns (c) != 3)