changeset 32074:03fe0b635d2e

quiver/quiver3: Overhaul input processing, validation, and add BISTs. * scripts/plot/draw/private/__quiver__.m: Overhaul numeric input validation. Simplify input classification using numeric input count switch statements and avoid quiver3 miscount due to scale factor. Add error messages for all valid numeric input combinations including vector x,y,z and scale factor. Move newplot command from quiver/quiver3 into __quiver__ after numeric input validation. Add hax as an output argument to return any changes back to calling function. * scripts/plot/draw/quiver.m: Remove newplot call. Update __quiver__ call to include hax as a return variable. Update docstring with note that line style and name-value pairs can both be provided but linstyle must appear first. Add BISTs to check standard inputs with single and multiple arrows, arrowhead shape, vector and array inputs, proper treatment of scaling factor "off", some simple input styles, and input validation BISTs to cover all numeric input errors. Added known failing BIST for linestyle+pair arrowhead showing when it should stay off (bug #64143). * scripts/plot/draw/quiver3.m: Remove newplot call. Update __quiver__ call to include hax as a return variable. Update docstring with note that line style and name-value pairs can both be provided but linstyle must appear first. Add BISTs to check standard inputs with single and multiple arrows, vector and array inputs, and input validation BISTs to cover all numeric input errors. * etc/NEWS.9.md: Update quiver/quiver3 improvement description under General Improvements.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Wed, 03 May 2023 22:52:33 -0400
parents 24752aa8be11
children 9583d971e603
files etc/NEWS.9.md scripts/plot/draw/private/__quiver__.m scripts/plot/draw/quiver.m scripts/plot/draw/quiver3.m
diffstat 4 files changed, 693 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.9.md	Wed May 03 20:45:33 2023 +0200
+++ b/etc/NEWS.9.md	Wed May 03 22:52:33 2023 -0400
@@ -19,11 +19,13 @@
 the number of decimal places (the fourth input) retains old behavior for
 backward compatibility, except that non-integer inputs will no longer error.
 
-- `quiver` and `quiver3` now properly plots non-float numeric inputs by
-internally recasting them to 'double'.  They honor the scaling factor input
-when there is only a single arrow, whereas the factor was previously ignored
-in that case. They also accept a scale factor of "off" which is equivalent to
-setting it to 0.
+- `quiver` and `quiver3` now properly plot non-float numeric inputs by
+internally recasting them to 'double' (bug #59695).  Scaling factor input
+processing is improved, with both functions honoring a previously ignored
+scaling factor input when there is only a single arrow (bug #39552), and
+`quiver3` no longer producing an error when a scaling factor is input
+without x and y inputs. Both functions now also accept a scale factor of
+"off" which is equivalent to setting it to 0.
 
 - The `inputParser` function has been re-architected for a 60% performance
 improvement.
--- a/scripts/plot/draw/private/__quiver__.m	Wed May 03 20:45:33 2023 +0200
+++ b/scripts/plot/draw/private/__quiver__.m	Wed May 03 22:52:33 2023 -0400
@@ -28,8 +28,7 @@
 ## Undocumented internal function.
 ## @end deftypefn
 
-function hg = __quiver__ (varargin)
-
+function [hax, hg]= __quiver__ (varargin)
   hax = varargin{1};
   is3d = varargin{2};
 
@@ -40,92 +39,120 @@
   ## in order to get equivalent visual results while keeping equivalent
   ## property values.
   arrowsize = 0.20;
-  firstnonnumeric = find (cellfun ("ischar", varargin(3:nargin)), 1);
-  if (isempty (firstnonnumeric))
-    firstnonnumeric = Inf;
+  lastnumeric = find (cellfun ("ischar", varargin(3:nargin)), 1) - 1;
 
+  if (isempty (lastnumeric))
+    lastnumeric = nargin;
     ## Recast non-float inputs as doubles to avoid erroneous plots.
     varargin(3:end) = cellfun ('double', varargin(3:end), ...
                                   "UniformOutput", false);
   else
-    firstnonnumeric += 2;
 
-    ## Recast non-float inputs as doubles.
-    varargin(3:firstnonnumeric-1) = cellfun ('double',
-                    varargin(3:firstnonnumeric-1), "UniformOutput", false);
+    lastnumeric += 2;
+    ## Recast non-float inputs as doubles to avoid erroneous plots.
+    varargin(3:lastnumeric) = cellfun ('double',
+                    varargin(3:lastnumeric), "UniformOutput", false);
 
     ## Check for scaling factor "off" and set it to 0.
-    if (strcmpi (varargin{firstnonnumeric}, "off"))
-      varargin(firstnonnumeric) = 0;
+    if ((nargin > lastnumeric) && strcmpi (varargin{lastnumeric+1}, "off"))
+      varargin(++lastnumeric) = 0;
+    endif
+  endif
+
+  if (is3d)
+    ## quiver3 3D input validation.
+    switch (lastnumeric)
+      case {6,7}
+        [z, u, v, w] = deal (varargin{3:6});
+        if (isvector (z) && ! isvector (u))
+          if (! size_equal (u, v, w))
+            error ("quiver3: U, V, and W must be the same size");
+          elseif (numel(z) != size (u, 3))
+            error (["quiver3: Z vector length must equal size of ", ...
+                        "U, V, and W in dim 3"]);
+          endif
+          [x, y, z] = meshgrid (1 : columns (u), 1 : rows (u), z);
+        else
+          if (! size_equal (z, u, v, w))
+            error ("quiver3: Z, U, V, and W must be the same size");
+          endif
+          [x, y] = meshgrid (1 : columns (u), 1 : rows (u), 1:size (u, 3));
+        endif
+
+      case {8,9}
+        [x, y, z, u, v, w] = deal (varargin{3:8});
+        if (isvector (x) && isvector (y) && isvector (z) && ! isvector (u))
+          if (! size_equal (u, v, w))
+            error ("quiver3: U, V, and W must be the same size");
+          elseif (numel(x) != columns (u))
+            error (["quiver3: X vector length must equal number of ", ...
+                        "columns in U, V, and W"]);
+          elseif (numel(y) != rows (u))
+            error (["quiver3: Y vector length must equal number of ", ...
+                        "rows in U, V, and W"]);
+          elseif (numel(z) != size (u, 3))
+            error (["quiver3: Z vector length must equal size of ", ...
+                        "U, V, and W in dim 3"]);
+          endif
+          [x, y, z] = meshgrid (x, y, z);
 
-      if ((firstnonnumeric) == nargin)
-        firstnonnumeric = Inf;
+        elseif (! size_equal (x, y, z, u, v, w))
+          error ("quiver3: X, Y, Z, U, V, and W must be the same size");
+        endif
+      otherwise
+        ## too few or too many numeric inputs before first style input
+        print_usage ("quiver3");
+    endswitch
+
+  else
+    ## quiver 2D input validation.
+    switch (lastnumeric)
+      case {4,5}
+        [u, v] = deal (varargin{3:4});
+        if (! size_equal (u, v))
+          error ("quiver: U and V must be the same size");
+        endif
+        [x, y] = meshgrid (1:columns (u), 1:rows (u));
+
+      case {6,7} #
+        [x, y, u, v] = deal (varargin{3:6});
+
+        if (isvector (x) && isvector (y) && ...
+                (! isvector (u) || ! isvector (v) ))
+           if (! size_equal (u, v))
+              error ("quiver: U and V must be the same size");
+           elseif (numel (x) != columns (u))
+              error (["quiver: X vector length must equal number of ", ...
+                        "columns in U and V"]);
+           elseif (numel (y) != rows (u))
+              error (["quiver: Y vector length must equal number of ", ...
+                        "rows in U and V"]);
+           endif
+          [x, y] = meshgrid (x, y);
+        elseif (! size_equal (x, y, u, v))
+          error ("quiver: X, Y, U, and V must be the same size");
+        endif
+      otherwise
+        ## too few or too many numeric inputs before first style input
+        print_usage ("quiver");
+    endswitch
+  endif
+
+  if (rem (lastnumeric, 2))
+    autoscale = varargin{lastnumeric}; # Last odd input is scale factor.
+
+    if (autoscale < 0 || ! isscalar (autoscale))
+      if (is3d)
+        error (["quiver3: scaling factor must be a non-negative scalar ", ...
+                 "or 'off'"]);
       else
-        firstnonnumeric++;
+        error (["quiver: scaling factor must be a non-negative scalar ", ...
+                 "or 'off'"]);
       endif
     endif
   endif
 
-  ioff = 3;
-  if (nargin < (6 + is3d) || firstnonnumeric < (6 + is3d))
-    if (is3d)
-      z = varargin{ioff++};
-    endif
-    u = varargin{ioff++};
-    v = varargin{ioff++};
-    if (is3d)
-      w = varargin{ioff++};
-    endif
-    if (is3d)
-      if (! size_equal (z, u, v, w))
-        error ("quiver3: Z, U, V, and W must be the same size");
-      endif
-    else
-      if (! size_equal (u, v))
-        error ("quiver: U and V must be the same size");
-      endif
-    endif
-    [x, y] = meshgrid (1:columns (u), 1:rows (u));
-
-    if (nargin >= ioff && isnumeric (varargin{ioff})
-        && isscalar (varargin{ioff}))
-      autoscale = varargin{ioff++};
-    endif
-  else
-    x = varargin{ioff++};
-    y = varargin{ioff++};
-    if (is3d)
-      z = varargin{ioff++};
-    endif
-    u = varargin{ioff++};
-    v = varargin{ioff++};
-    if (is3d)
-      w = varargin{ioff++};
-      if (isvector (x) && isvector (y) && isvector (z)
-          && (! isvector (u) || ! isvector (v) || ! isvector (w)))
-        [x, y, z] = meshgrid (x, y, z);
-      endif
-    else
-      if (isvector (x) && isvector (y) && (! isvector (u) || ! isvector (v)))
-        [x, y] = meshgrid (x, y);
-      endif
-    endif
-    if (is3d)
-      if (! size_equal (x, y, z, u, v, w))
-        error ("quiver3: X, Y, Z, U, V, and W must be the same size");
-      endif
-    else
-      if (! size_equal (x, y, u, v))
-        error ("quiver: X, Y, U, and V must be the same size");
-      endif
-    endif
-
-    if (nargin >= ioff && isnumeric (varargin{ioff})
-        && isscalar (varargin{ioff}))
-      autoscale = varargin{ioff++};
-    endif
-  endif
-
+  ioff = lastnumeric + 1;
   have_filled = false;
   have_line_spec = false;
   args = {};
@@ -193,6 +220,7 @@
     endif
   endif
 
+  hax = newplot (hax);
   hstate = get (hax, "nextplot");
   unwind_protect
     if (have_line_spec)
@@ -352,6 +380,7 @@
     if (! isempty (args))
       set (hg, args{:});
     endif
+
   unwind_protect_cleanup
     set (hax, "nextplot", hstate);
   end_unwind_protect
--- a/scripts/plot/draw/quiver.m	Wed May 03 20:45:33 2023 +0200
+++ b/scripts/plot/draw/quiver.m	Wed May 03 22:52:33 2023 -0400
@@ -36,8 +36,8 @@
 ##
 ## Plot the (@var{u}, @var{v}) components of a vector field at the grid points
 ## defined by (@var{x}, @var{y}).  If the grid is uniform then @var{x} and
-## @var{y} can be specified as vectors and @code{meshgrid} is used to create
-## the 2-D grid.
+## @var{y} can be specified as grid vectors and @code{meshgrid} is used to
+## create the 2-D grid.
 ##
 ## If @var{x} and @var{y} are not given they are assumed to be
 ## @code{(1:@var{m}, 1:@var{n})} where
@@ -48,12 +48,13 @@
 ## result in the longest vector exactly filling one grid square.  A value of 0
 ## or "off" disables all scaling.  The default value is 0.9.
 ##
-## The style to use for the plot can be defined with a line style @var{style}
+## The style to use for the plot can be defined with a line style, @var{style},
 ## of the same format as the @code{plot} command.  If a marker is specified
 ## then the markers are drawn at the origin of the vectors (which are the grid
 ## points defined by @var{x} and @var{y}).  When a marker is specified, the
 ## arrowhead is not drawn.  If the argument @qcode{"filled"} is given then the
-## markers are filled.
+## markers are filled.  If name-value plot style properties are used, they must
+## appear in pairs and follow any other plot style arguments.
 ##
 ## If the first argument @var{hax} is an axes handle, then plot into this axes,
 ## rather than the current axes returned by @code{gca}.
@@ -88,8 +89,7 @@
     oldfig = get (0, "currentfigure");
   endif
   unwind_protect
-    hax = newplot (hax);
-    htmp = __quiver__ (hax, false, varargin{:});
+    [hax, htmp] = __quiver__ (hax, false, varargin{:});
 
     ## FIXME: This should be moved into __quiver__ when problem with
     ##        re-initialization of title object is fixed.
@@ -139,8 +139,321 @@
 %! hold on; plot (x,y,"r"); hold off;
 %! title ("quiver() with scaled arrows");
 
+## Check standard inputs, single arrow.
+%!test
+%! hf = figure ("visible", "off");
+%! hax = gca();
+%! unwind_protect
+%!   h = quiver (hax, 1, 2);
+%!   childxdata = get (get (h, "children"), "xdata");
+%!   stemchild = find (cellfun (@numel, childxdata) == 3);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{stemchild}(1), 1, eps);
+%!   assert (childxdata{stemchild}(2), 1 + 1*0.9, eps);
+%!   assert (isnan (childxdata{stemchild}(3)));
+%!   assert (childxdata{arrowheadchild}(2), 1 + 1*0.9, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(4)));
+%!
+%!   h = quiver (hax, 1, 2, 0.5);
+%!   childxdata = get (get (h, "children"), "xdata");
+%!   stemchild = find (cellfun (@numel, childxdata) == 3);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{stemchild}(1), 1, eps);
+%!   assert (childxdata{stemchild}(2), 1 + 1*0.5, eps);
+%!   assert (isnan (childxdata{stemchild}(3)));
+%!   assert (childxdata{arrowheadchild}(2), 1 + 1*0.5, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(4)));
+%!
+%!   h = quiver (hax, 0, 1, 2, 3);
+%!   childxdata = get (get (h, "children"), "xdata");
+%!   stemchild = find (cellfun (@numel, childxdata) == 3);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{stemchild}(1), 0, eps);
+%!   assert (childxdata{stemchild}(2), 0 + 2*0.9, eps);
+%!   assert (isnan (childxdata{stemchild}(3)));
+%!   assert (childxdata{arrowheadchild}(2), 0 + 2*0.9, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(4)));
+%!
+%!   h = quiver (hax, 0, 1, 2, 3, 0.5);
+%!   childxdata = get (get (h, "children"), "xdata");
+%!   stemchild = find (cellfun (@numel, childxdata) == 3);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{stemchild}(1), 0, eps);
+%!   assert (childxdata{stemchild}(2), 0 + 2*0.5, eps);
+%!   assert (isnan (childxdata{stemchild}(3)));
+%!   assert (childxdata{arrowheadchild}(2), 0 + 2*0.5, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(4)));
+%!
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
 
-%!test <*39552> # Check arrow length, scale factor adjustment, one arrow.
+## Check arrowhead size
+%!test
+%! hf = figure ("visible", "off");
+%! hax = gca();
+%! unwind_protect
+%!   h = quiver (hax, 0, 0, 0, 1, 1); # up
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{arrowheadchild}, [1/9 0 -1/9 NaN], eps);
+%!   assert (childydata{arrowheadchild}, [2/3 1 2/3 NaN], eps);
+%!
+%!   h = quiver (hax, 0, 0, 0, -1, 1); # down
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{arrowheadchild}, [-1/9 0 1/9 NaN], eps);
+%!   assert (childydata{arrowheadchild}, [-2/3 -1 -2/3 NaN], eps);
+%!
+%!   h = quiver (hax, 0, 0, -1, 0, 1); # left
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{arrowheadchild}, [-2/3 -1 -2/3 NaN], eps);
+%!   assert (childydata{arrowheadchild}, [1/9 0 -1/9 NaN], eps);
+%!
+%!   h = quiver (hax, 0, 0, 1, 0, 1); # right
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{arrowheadchild}, [2/3 1 2/3 NaN], eps);
+%!   assert (childydata{arrowheadchild}, [-1/9 0 1/9 NaN], eps);
+%!
+%!   h = quiver (hax, 0, 0, 1, 1, 1); # 45 deg - symmetric
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{arrowheadchild}, [7/9 1 5/9 NaN], eps);
+%!   assert (childydata{arrowheadchild}, [5/9 1 7/9 NaN], eps);
+%!
+%!   h = quiver (hax, 0, 0, sqrt(3), 1, 1); # 30 deg
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{arrowheadchild}, [(6*sqrt(3)+1)/9, sqrt(3), (6*sqrt(3)-1)/9, NaN], eps);
+%!   assert (childydata{arrowheadchild}, [(6-sqrt(3))/9, 1, (6+sqrt(3))/9, NaN], eps);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## Check standard inputs, multiple arrows.
+%!test
+%! hf = figure ("visible", "off");
+%! hax = gca();
+%! unwind_protect
+%!   [x,y] = meshgrid (0:1);
+%!   u = [0 1; 1 -2];
+%!   v = [1 0; 1 -2];
+%!   numpts = 4;
+%!   h = quiver (hax, u, v, 1);  # assumes [x,y] = meshgrid (1:2)
+%!   childxdata = get (get (h, "children"), "xdata");
+%!   basechild = find (cellfun (@numel, childxdata) == 1*numpts);
+%!   stemchild = find (cellfun (@numel, childxdata) == 3*numpts);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4*numpts);
+%!   assert (childxdata{basechild}, [1 1 2 2]);
+%!   assert (childxdata{stemchild}, [1,1,NaN,1,1.25,NaN,2,2.25,NaN,2,1.5,NaN], eps);
+%!   assert (childxdata{arrowheadchild}([2, 6, 10, 14]), [1, 1.25, 2.25, 1.5], eps);
+%!   assert (childxdata{arrowheadchild}([4, 8, 12, 16]), NaN(1,4), eps);
+%!
+%!   h = quiver (hax, x, y, u, v, 1);
+%!   childxdata = get (get (h, "children"), "xdata");
+%!   basechild = find (cellfun (@numel, childxdata) == 1*numpts);
+%!   stemchild = find (cellfun (@numel, childxdata) == 3*numpts);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4*numpts);
+%!   assert (childxdata{basechild}, [0 0 1 1]);
+%!   assert (childxdata{stemchild}, [0,0,NaN,0,0.25,NaN,1,1.25,NaN,1,0.5,NaN], eps);
+%!   assert (childxdata{arrowheadchild}([2, 6, 10, 14]), [0, 0.25, 1.25, 0.5], eps);
+%!   assert (childxdata{arrowheadchild}([4, 8, 12, 16]), NaN(1,4), eps);
+%!
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## Check multiple arrows, vector inputs identical to array inputs.
+%!test
+%! hf = figure ("visible", "off");
+%! hax = gca();
+%! unwind_protect
+%!   [x,y] = meshgrid (0:1);
+%!   u = [0 1; 1 -2];
+%!   v = [1 0; 1 -2];
+%!   h = quiver (hax, x, y, u, v, 1);  # arrayinput
+%!   haxarray = get(hax);
+%!   haxarray.children = [];
+%!   haxarray.xlabel = [];
+%!   haxarray.ylabel = [];
+%!   haxarray.zlabel = [];
+%!   haxarray.title = [];
+%!   parentarray = get(h);
+%!   parentarray.children = [];
+%!   childrenarray = get (get (h, "children"));
+%!   [childrenarray.parent] = deal ([]);
+%!   h = quiver (hax, [0:1], [0:1], u, v, 1);
+%!   haxvect1 = get(hax);
+%!   haxvect1.children = [];
+%!   haxvect1.xlabel= [];
+%!   haxvect1.ylabel= [];
+%!   haxvect1.zlabel= [];
+%!   haxvect1.title= [];
+%!   parentvect1 = get(h);
+%!   parentvect1.children = [];
+%!   childrenvect1 = get (get (h, "children"));
+%!   [childrenvect1.parent] = deal ([]);
+%!   assert (isequaln (haxarray, haxvect1));
+%!   assert (isequaln (parentarray, parentvect1));
+%!   assert (isequaln (childrenarray, childrenvect1));
+%!   h = quiver (hax, [0:1], [0:1]', u, v, 1);
+%!   haxvect2 = get(hax);
+%!   haxvect2.children = [];
+%!   haxvect2.xlabel= [];
+%!   haxvect2.ylabel= [];
+%!   haxvect2.zlabel= [];
+%!   haxvect2.title= [];
+%!   parentvect2 = get(h);
+%!   parentvect2.children = [];
+%!   childrenvect2 = get (get (h, "children"));
+%!   [childrenvect2.parent] = deal ([]);
+%!   assert (isequaln (haxvect1, haxvect2));
+%!   assert (isequaln (parentvect1, parentvect2));
+%!   assert (isequaln (childrenvect1, childrenvect2));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## Check scale factor "off" is identical to scale factor = 0.
+%!test
+%! hf = figure ("visible", "off");
+%! hax = gca();
+%! unwind_protect
+%!   h = quiver (hax, 1, 2, 0);
+%!   haxzero = get(hax);
+%!   haxzero.children = [];
+%!   haxzero.xlabel = [];
+%!   haxzero.ylabel = [];
+%!   haxzero.zlabel = [];
+%!   haxzero.title = [];
+%!   parentzero = get(h);
+%!   parentzero.children = [];
+%!   childrenzero = get (get (h, "children"));
+%!   [childrenzero.parent] = deal ([]);
+%!   h = quiver (hax, 1, 2, "off");
+%!   haxoff = get(hax);
+%!   haxoff.children = [];
+%!   haxoff.xlabel= [];
+%!   haxoff.ylabel= [];
+%!   haxoff.zlabel= [];
+%!   haxoff.title= [];
+%!   parentoff = get(h);
+%!   parentoff.children = [];
+%!   childrenoff = get (get (h, "children"));
+%!   [childrenoff.parent] = deal ([]);
+%!   assert (isequaln (haxzero, haxoff));
+%!   assert (isequaln (parentzero, parentoff));
+%!   assert (isequaln (childrenzero, childrenoff));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## Check input styles.
+%!test
+%! hf = figure ("visible", "off");
+%! hax = gca();
+%! unwind_protect
+%!   h = quiver (hax, 0, 1, 2, 3, "-o"); # Linestyle
+%!   parent = get (h);
+%!   assert (strcmp (parent.marker, "o"));
+%!   assert (strcmp (parent.markerfacecolor, "none"));
+%!   childdata = get (parent.children);
+%!   basechild = find (cellfun (@numel, {childdata.xdata}) == 1);
+%!   arrowheadchild = find (cellfun (@numel, {childdata.xdata}) == 4);
+%!   assert (strcmp (childdata(basechild).marker, "o"));
+%!   assert (strcmp (childdata(basechild).markerfacecolor, "none"));
+%!   assert (strcmp (childdata(basechild).linestyle, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).marker, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).markerfacecolor, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).linestyle, "none"));
+%!
+%!   h = quiver (hax, 0, 1, 2, 3, "-o", "filled");  # Linestyle + filled.
+%!   parent = get (h);
+%!   assert (strcmp (parent.marker, "o"));
+%!   assert (numel (parent.markerfacecolor), 3);
+%!   childdata = get (parent.children);
+%!   basechild = find (cellfun (@numel, {childdata.xdata}) == 1);
+%!   arrowheadchild = find (cellfun (@numel, {childdata.xdata}) == 4);
+%!   assert (strcmp (childdata(basechild).marker, "o"));
+%!   assert (numel (childdata(basechild).markerfacecolor), 3);
+%!   assert (strcmp (childdata(basechild).linestyle, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).marker, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).markerfacecolor, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).linestyle, "none"));
+%!
+%!   h = quiver (hax, 0, 1, 2, 3, "linewidth", 10); # Name/value pair.
+%!   parent = get (h);
+%!   assert (strcmp (parent.marker, "none"));
+%!   assert (strcmp (parent.markerfacecolor, "none"));
+%!   assert (strcmp (parent.linestyle, "-"));
+%!   assert (parent.linewidth, 10);
+%!   childdata = get (parent.children);
+%!   basechild = find (cellfun (@numel, {childdata.xdata}) == 1);
+%!   stemchild = find (cellfun (@numel, {childdata.xdata}) == 3);
+%!   arrowheadchild = find (cellfun (@numel, {childdata.xdata}) == 4);
+%!   assert (strcmp (childdata(basechild).marker, "none"));
+%!   assert (strcmp (childdata(basechild).markerfacecolor, "none"));
+%!   assert (strcmp (childdata(basechild).linestyle, "none"));
+%!   assert (strcmp (childdata(stemchild).marker, "none"));
+%!   assert (strcmp (childdata(stemchild).markerfacecolor, "none"));
+%!   assert (strcmp (childdata(stemchild).linestyle, "-"));
+%!   assert (childdata(stemchild).linewidth, 10);
+%!   assert (strcmp (childdata(arrowheadchild).marker, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).markerfacecolor, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).linestyle, "-"));
+%!   assert (childdata(arrowheadchild).linewidth, 10);
+%!
+%!  unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## Test both Linestyle + name/value pair
+%!test <64143>
+%! hf = figure ("visible", "off");
+%! hax = gca();
+%! unwind_protect
+%!   h = quiver (hax, 0, 1, 2, 3, "-o", "linewidth", 10);
+%!   parent = get (h);
+%!   assert (strcmp (parent.marker, "o"));
+%!   assert (strcmp (parent.markerfacecolor, "none"));
+%!   assert (strcmp (parent.linestyle, "-"));
+%!   assert (parent.linewidth, 10);
+%!   childdata = get (parent.children);
+%!   basechild = find (cellfun (@numel, {childdata.xdata}) == 1);
+%!   stemchild = find (cellfun (@numel, {childdata.xdata}) == 3);
+%!   arrowheadchild = find (cellfun (@numel, {childdata.xdata}) == 4);
+%!   assert (strcmp (childdata(basechild).marker, "o"));
+%!   assert (strcmp (childdata(basechild).markerfacecolor, "none"));
+%!   assert (strcmp (childdata(basechild).linestyle, "none"));
+%!   assert (strcmp (childdata(stemchild).marker, "none"));
+%!   assert (strcmp (childdata(stemchild).markerfacecolor, "none"));
+%!   assert (strcmp (childdata(stemchild).linestyle, "-"));
+%!   assert (childdata(stemchild).linewidth, 10);
+%!   assert (strcmp (childdata(arrowheadchild).marker, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).markerfacecolor, "none"));
+%!   assert (strcmp (childdata(arrowheadchild).linestyle, "none"));
+%!   assert (childdata(arrowheadchild).linewidth, 10);
+%!
+%!  unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## Check arrow length, scale factor adjustment, one arrow.
+%!test <*39552>
 %! hf = figure ("visible", "off");
 %! hax = gca ();
 %! unwind_protect
@@ -167,7 +480,8 @@
 %!   close (hf);
 %! end_unwind_protect
 
-%!test <*39552> # Check arrow length, scale factor adjustment, multiple arrows.
+## Check arrow length, scale factor adjustment, multiple arrows.
+%!test <*39552>
 %! hf = figure ("visible", "off");
 %! hax = gca ();
 %! unwind_protect
@@ -198,13 +512,15 @@
 %!   close (hf);
 %! end_unwind_protect
 
-%!test <*59695> # Check for proper plotting with non-float inputs.
+## Check for proper plotting with non-float inputs.
+%!test <*59695>
 %! hf = figure ("visible", "off");
 %! hax = gca ();
 %! unwind_protect
 %!   h = quiver (int32(1), int32(1), int32(1), int32(1), double(0.5));
-%!   childxdata = get (get (h, "children"), "xdata");
-%!   childydata = get (get (h, "children"), "ydata");
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
 %!   assert (all (strcmp (cellfun (...
 %!                 'class', childxdata, 'UniformOutput', false), "double")));
 %!   assert (all (strcmp (cellfun (...
@@ -215,8 +531,9 @@
 %!   assert (childydata{3}(2) , 1.5, eps);
 %!
 %!   h = quiver (0.5, 0.5, 0.5, 0.5, int32(1));
-%!   childxdata = get (get (h, "children"), "xdata");
-%!   childydata = get (get (h, "children"), "ydata");
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
 %!   assert (all (strcmp (cellfun (...
 %!                 'class', childxdata, 'UniformOutput', false), "double")));
 %!   assert (all (strcmp (cellfun (...
@@ -227,8 +544,9 @@
 %!   assert (childydata{3}(2) , 1, eps);
 %!
 %!   h = quiver (false, true, false, true, true);
-%!   childxdata = get (get (h, "children"), "xdata");
-%!   childydata = get (get (h, "children"), "ydata");
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
 %!   assert (all (strcmp (cellfun (...
 %!                 'class', childxdata, 'UniformOutput', false), "double")));
 %!   assert (all (strcmp (cellfun (...
@@ -245,5 +563,20 @@
 ## Test input validation
 %!error <Invalid call> quiver()
 %!error <Invalid call> quiver(1.1)
+%!error <Invalid call> quiver(1.1, "foo")
+%!error <Invalid call> quiver(1.1, 2, 3, 4, 5, 6, "foo")
+%!error <U and V must be the same size> quiver ([1, 2], 3)
+%!error <U and V must be the same size> quiver (1.1, [2, 3])
+%!error <U and V must be the same size> quiver (1.1, 2, eye(2), 4)
+%!error <U and V must be the same size> quiver (1.1, 2, 3, eye(2))
+%!error <X vector length must equal> quiver (1.1, [2 3], eye(2), eye(2))
+%!error <Y vector length must equal> quiver ([1, 2], 3, eye(2), eye(2))
+%!error <X, Y, U, and V must be the same size> quiver (eye(3), eye(2), eye(2), eye(2))
+%!error <X, Y, U, and V must be the same size> quiver (eye(2), eye(3), eye(2), eye(2))
+%!error <X, Y, U, and V must be the same size> quiver (eye(2), eye(2), eye(3), eye(2))
+%!error <X, Y, U, and V must be the same size> quiver (eye(2), eye(2), eye(2), eye(3))
+%!error <scaling factor must be> quiver (10, 20, -5)
+%!error <scaling factor must be> quiver (10, 20, [1 2])
+%!error <scaling factor must be> quiver (10, 20, 30, 40, -5)
+%!error <scaling factor must be> quiver (10, 20, 30, 40, [1 2])
 
-
--- a/scripts/plot/draw/quiver3.m	Wed May 03 20:45:33 2023 +0200
+++ b/scripts/plot/draw/quiver3.m	Wed May 03 22:52:33 2023 -0400
@@ -36,7 +36,7 @@
 ##
 ## Plot the (@var{u}, @var{v}, @var{w}) components of a vector field at the
 ## grid points defined by (@var{x}, @var{y}, @var{z}).  If the grid is uniform
-## then @var{x}, @var{y}, and @var{z} can be specified as vectors and
+## then @var{x}, @var{y}, and @var{z} can be specified as grid vectors and
 ## @code{meshgrid} is used to create the 3-D grid.
 ##
 ## If @var{x} and @var{y} are not given they are assumed to be
@@ -53,7 +53,8 @@
 ## then the markers are drawn at the origin of the vectors (which are the grid
 ## points defined by @var{x}, @var{y}, @var{z}).  When a marker is specified,
 ## the arrowhead is not drawn.  If the argument @qcode{"filled"} is given then
-## the markers are filled.
+## the markers are filled.  If name-value plot style properties are used, they
+## must appear in pairs and follow any other plot style arguments.
 ##
 ## If the first argument @var{hax} is an axes handle, then plot into this axes,
 ## rather than the current axes returned by @code{gca}.
@@ -89,8 +90,7 @@
     oldfig = get (0, "currentfigure");
   endif
   unwind_protect
-    hax = newplot (hax);
-    htmp = __quiver__ (hax, true, varargin{:});
+    [hax, htmp] = __quiver__ (hax, true, varargin{:});
 
     if (! ishold ())
       set (hax, "view", [-37.5, 30],
@@ -108,7 +108,6 @@
 
 endfunction
 
-
 %!demo
 %! clf;
 %! colormap ("default");
@@ -135,9 +134,238 @@
 %! title ({"quiver3() of surface normals to peaks() function"; ...
 %!         'shading "interp"'});
 
+## Check standard inputs, single arrow.
+%!test
+%! hf = figure ("visible", "off");
+%! hax = gca ();
+%! unwind_protect
+%!
+%!   h = quiver3 (hax, 0, 1, 2, 3);
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   childzdata = get (children, "zdata");
+%!   stemchild = find (cellfun (@numel, childxdata) == 3);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{stemchild}(1), 1, eps);
+%!   assert (childxdata{stemchild}(2), 1 + 1*0.9, eps);
+%!   assert (isnan (childxdata{stemchild}(3)));
+%!   assert (childxdata{arrowheadchild}(2), 1 + 1*0.9, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(4)));
+%!   assert (childydata{stemchild}(1), 1, eps);
+%!   assert (childydata{stemchild}(2), 1 + 2*0.9, eps);
+%!   assert (isnan (childydata{stemchild}(3)));
+%!   assert (childydata{arrowheadchild}(2), 1 + 2*0.9, eps);
+%!   assert (isnan (childydata{arrowheadchild}(4)));
+%!   assert (childzdata{stemchild}(1), 0, eps);
+%!   assert (childzdata{stemchild}(2), 0 + 3*0.9, eps);
+%!   assert (isnan (childzdata{stemchild}(3)));
+%!   assert (childzdata{arrowheadchild}(2), 0 + 3*0.9, eps);
+%!   assert (isnan (childzdata{arrowheadchild}(4)));
+%!
+%!   h = quiver3 (hax, 1, 1, 0, 1, 2, 3);
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   childzdata = get (children, "zdata");
+%!   stemchild = find (cellfun (@numel, childxdata) == 3);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == 4);
+%!   assert (childxdata{stemchild}(1), 1, eps);
+%!   assert (childxdata{stemchild}(2), 1 + 1*0.9, eps);
+%!   assert (isnan (childxdata{stemchild}(3)));
+%!   assert (childxdata{arrowheadchild}(2), 1 + 1*0.9, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(4)));
+%!   assert (childydata{stemchild}(1), 1, eps);
+%!   assert (childydata{stemchild}(2), 1 + 2*0.9, eps);
+%!   assert (isnan (childydata{stemchild}(3)));
+%!   assert (childydata{arrowheadchild}(2), 1 + 2*0.9, eps);
+%!   assert (isnan (childydata{arrowheadchild}(4)));
+%!   assert (childzdata{stemchild}(1), 0, eps);
+%!   assert (childzdata{stemchild}(2), 0 + 3*0.9, eps);
+%!   assert (isnan (childzdata{stemchild}(3)));
+%!   assert (childzdata{arrowheadchild}(2), 0 + 3*0.9, eps);
+%!   assert (isnan (childzdata{arrowheadchild}(4)));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## Check standard inputs, multiple arrows.
+%!test
+%! hf = figure ("visible", "off");
+%! hax = gca ();
+%! unwind_protect
+%!
+%!   a = reshape(1:12,2,3,2);
+%!   x = 1:3; y = 1:2; z = 1:2;
+%!   [xx,yy,zz] = meshgrid (x,y,z);
+%!   numpts = 12;
+%!   sf= sqrt(sumsq([1/3 1/2 11/6])/432); # Actual internal scale factor, z=a.
+%!   sf2= sqrt(sumsq([1/3 1/2 1/6])/432); # z vector internal scale factor.
+%!
+%!   h = quiver3 (hax, a, a, a, a, 1); # No x,y input.
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   childzdata = get (children, "zdata");
+%!   basechild = find (cellfun (@numel, childxdata) == numpts);
+%!   stemchild = find (cellfun (@numel, childxdata) == numpts*3);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == numpts*4);
+%!   ## Check all bases.
+%!   assert (childxdata{basechild}, [1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3]);
+%!   assert (childydata{basechild}, [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]);
+%!   assert (childzdata{basechild}, [1:12]);
+%!   ## Check first arrow.
+%!   assert (childxdata{stemchild}(1), 1, eps);
+%!   assert (childxdata{stemchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childxdata{stemchild}(3)));
+%!   assert (childxdata{arrowheadchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(4)));
+%!   assert (childydata{stemchild}(1), 1, eps);
+%!   assert (childydata{stemchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childydata{stemchild}(3)));
+%!   assert (childydata{arrowheadchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childydata{arrowheadchild}(4)));
+%!   assert (childzdata{stemchild}(1), 1, eps);
+%!   assert (childzdata{stemchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childzdata{stemchild}(3)));
+%!   assert (childzdata{arrowheadchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childzdata{arrowheadchild}(4)));
+%!   ## Check last arrow.
+%!   assert (childxdata{stemchild}(numpts*3-2), 3, eps);
+%!   assert (childxdata{stemchild}(numpts*3-1), 3 + 12*sf, eps);
+%!   assert (isnan (childxdata{stemchild}(end)));
+%!   assert (childxdata{arrowheadchild}(numpts*4-2), 3 + 12*sf, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(end)));
+%!   assert (childydata{stemchild}(numpts*3-2), 2, eps);
+%!   assert (childydata{stemchild}(numpts*3-1), 2 + 12*sf, eps);
+%!   assert (isnan (childydata{stemchild}(end)));
+%!   assert (childydata{arrowheadchild}(numpts*4-2), 2 + 12*sf, eps);
+%!   assert (isnan (childydata{arrowheadchild}(end)));
+%!   assert (childzdata{stemchild}(numpts*3-2), 12, eps);
+%!   assert (childzdata{stemchild}(numpts*3-1), 12 + 12*sf, eps);
+%!   assert (isnan (childzdata{stemchild}(end)));
+%!   assert (childzdata{arrowheadchild}(numpts*4-2), 12 + 12*sf, eps);
+%!   assert (isnan (childzdata{arrowheadchild}(end)));
+%!
+%!   h = quiver3 (hax, xx, yy, a, a, a, a, 1); # x,y input as matrices.
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   childzdata = get (children, "zdata");
+%!   basechild = find (cellfun (@numel, childxdata) == numpts);
+%!   stemchild = find (cellfun (@numel, childxdata) == numpts*3);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == numpts*4);
+%!   ## Check all bases.
+%!   assert (childxdata{basechild}, [1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3]);
+%!   assert (childydata{basechild}, [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]);
+%!   assert (childzdata{basechild}, [1:12]);
+%!   ## Check first arrow.
+%!   assert (childxdata{stemchild}(1), 1, eps);
+%!   assert (childxdata{stemchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childxdata{stemchild}(3)));
+%!   assert (childxdata{arrowheadchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(4)));
+%!   assert (childydata{stemchild}(1), 1, eps);
+%!   assert (childydata{stemchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childydata{stemchild}(3)));
+%!   assert (childydata{arrowheadchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childydata{arrowheadchild}(4)));
+%!   assert (childzdata{stemchild}(1), 1, eps);
+%!   assert (childzdata{stemchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childzdata{stemchild}(3)));
+%!   assert (childzdata{arrowheadchild}(2), 1 + 1*sf, eps);
+%!   assert (isnan (childzdata{arrowheadchild}(4)));
+%!   ## Check last arrow.
+%!   assert (childxdata{stemchild}(numpts*3-2), 3, eps);
+%!   assert (childxdata{stemchild}(numpts*3-1), 3 + 12*sf, eps);
+%!   assert (isnan (childxdata{stemchild}(end)));
+%!   assert (childxdata{arrowheadchild}(numpts*4-2), 3 + 12*sf, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(end)));
+%!   assert (childydata{stemchild}(numpts*3-2), 2, eps);
+%!   assert (childydata{stemchild}(numpts*3-1), 2 + 12*sf, eps);
+%!   assert (isnan (childydata{stemchild}(end)));
+%!   assert (childydata{arrowheadchild}(numpts*4-2), 2 + 12*sf, eps);
+%!   assert (isnan (childydata{arrowheadchild}(end)));
+%!   assert (childzdata{stemchild}(numpts*3-2), 12, eps);
+%!   assert (childzdata{stemchild}(numpts*3-1), 12 + 12*sf, eps);
+%!   assert (isnan (childzdata{stemchild}(end)));
+%!   assert (childzdata{arrowheadchild}(numpts*4-2), 12 + 12*sf, eps);
+%!   assert (isnan (childzdata{arrowheadchild}(end)));
+%!
+%!   h = quiver3 (hax, x, y, z, a, a, a, 1); # x,y z input as vectors.
+%!   children = get (h, "children");
+%!   childxdata = get (children, "xdata");
+%!   childydata = get (children, "ydata");
+%!   childzdata = get (children, "zdata");
+%!   basechild = find (cellfun (@numel, childxdata) == numpts);
+%!   stemchild = find (cellfun (@numel, childxdata) == numpts*3);
+%!   arrowheadchild = find (cellfun (@numel, childxdata) == numpts*4);
+%!   ## Check all bases.
+%!   assert (childxdata{basechild}, [1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3]);
+%!   assert (childydata{basechild}, [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]);
+%!   assert (childzdata{basechild}, [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2]);
+%!   ## Check first arrow.
+%!   assert (childxdata{stemchild}(1), 1, eps);
+%!   assert (childxdata{stemchild}(2), 1 + 1*sf2, eps);
+%!   assert (isnan (childxdata{stemchild}(3)));
+%!   assert (childxdata{arrowheadchild}(2), 1 + 1*sf2, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(4)));
+%!   assert (childydata{stemchild}(1), 1, eps);
+%!   assert (childydata{stemchild}(2), 1 + 1*sf2, eps);
+%!   assert (isnan (childydata{stemchild}(3)));
+%!   assert (childydata{arrowheadchild}(2), 1 + 1*sf2, eps);
+%!   assert (isnan (childydata{arrowheadchild}(4)));
+%!   assert (childzdata{stemchild}(1), 1, eps);
+%!   assert (childzdata{stemchild}(2), 1 + 1*sf2, eps);
+%!   assert (isnan (childzdata{stemchild}(3)));
+%!   assert (childzdata{arrowheadchild}(2), 1 + 1*sf2, eps);
+%!   assert (isnan (childzdata{arrowheadchild}(4)));
+%!   ## Check last arrow.
+%!   assert (childxdata{stemchild}(numpts*3-2), 3, eps);
+%!   assert (childxdata{stemchild}(numpts*3-1), 3 + 12*sf2, eps);
+%!   assert (isnan (childxdata{stemchild}(end)));
+%!   assert (childxdata{arrowheadchild}(numpts*4-2), 3 + 12*sf2, eps);
+%!   assert (isnan (childxdata{arrowheadchild}(end)));
+%!   assert (childydata{stemchild}(numpts*3-2), 2, eps);
+%!   assert (childydata{stemchild}(numpts*3-1), 2 + 12*sf2, eps);
+%!   assert (isnan (childydata{stemchild}(end)));
+%!   assert (childydata{arrowheadchild}(numpts*4-2), 2 + 12*sf2, eps);
+%!   assert (isnan (childydata{arrowheadchild}(end)));
+%!   assert (childzdata{stemchild}(numpts*3-2), 2, eps);
+%!   assert (childzdata{stemchild}(numpts*3-1), 2 + 12*sf2, eps);
+%!   assert (isnan (childzdata{stemchild}(end)));
+%!   assert (childzdata{arrowheadchild}(numpts*4-2), 2 + 12*sf2, eps);
+%!   assert (isnan (childzdata{arrowheadchild}(end)));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
 ##Test input validation
 %!error <Invalid call> quiver3 ()
 %!error <Invalid call> quiver3 (1.1)
 %!error <Invalid call> quiver3 (1.1, 2)
 %!error <Invalid call> quiver3 (1.1, 2, 3)
-
+%!error <Invalid call> quiver3 (1.1, 2, 3, "foo")
+%!error <Invalid call> quiver3 (1.1, 2, 3, 4, 5, 6, 7, 8, "foo")
+%!error <U, V, and W must be the same> quiver3 (30, [40 50], 60, 70)
+%!error <Z vector length must equal size of> quiver3 ([30 40], eye(3), eye(3), eye(3))
+%!error <Z, U, V, and W must be the same> quiver3 ([30 40], 50, 60, 70)
+%!error <Z, U, V, and W must be the same> quiver3 (eye(2), eye(3), eye(2), eye(2))
+%!error <Z, U, V, and W must be the same> quiver3 (eye(2), eye(2), eye(3), eye(2))
+%!error <Z, U, V, and W must be the same> quiver3 (eye(2), eye(2), eye(2), eye(3))
+%!error <U, V, and W must be the same size> quiver3 ([1:2], [1:2], 1, eye(3), eye(2), eye(2))
+%!error <U, V, and W must be the same size> quiver3 ([1:2], [1:2], 1, eye(2), eye(3), eye(2))
+%!error <U, V, and W must be the same size> quiver3 ([1:2], [1:2], 1, eye(2), eye(2), eye(3))
+%!error <X vector length must equal number of> quiver3 ([1:3], [1:2], 1, eye(2), eye(2), eye(2))
+%!error <Y vector length must equal number of> quiver3 ([1:2], [1:3], 1, eye(2), eye(2), eye(2))
+%!error <Z vector length must equal size of> quiver3 ([1:2], [1:2], [1:2], eye(2), eye(2), eye(2))
+%!error <X, Y, Z, U, V, and W must be the same size> quiver3 (eye(3), eye(2), eye(2), eye(2), eye(2), eye(2))
+%!error <X, Y, Z, U, V, and W must be the same size> quiver3 (eye(2), eye(3), eye(2), eye(2), eye(2), eye(2))
+%!error <X, Y, Z, U, V, and W must be the same size> quiver3 (eye(2), eye(2), eye(3), eye(2), eye(2), eye(2))
+%!error <X, Y, Z, U, V, and W must be the same size> quiver3 (eye(2), eye(2), eye(2), eye(3), eye(2), eye(2))
+%!error <X, Y, Z, U, V, and W must be the same size> quiver3 (eye(2), eye(2), eye(2), eye(2), eye(3), eye(2))
+%!error <X, Y, Z, U, V, and W must be the same size> quiver3 (eye(2), eye(2), eye(2), eye(2), eye(2), eye(3))
+%!error <scaling factor must be> quiver3 (10, 20, 30, 40, -5)
+%!error <scaling factor must be> quiver3 (10, 20, 30, 40, [1 2])
+%!error <scaling factor must be> quiver3 (10, 20, 30, 40, 50, 60, -5)
+%!error <scaling factor must be> quiver3 (10, 20, 30, 40, 50, 60, [1 2])