Mercurial > octave
changeset 24383:2798d4bd7147
maint: merge stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 07 Dec 2017 09:56:30 -0800 |
parents | 51a1d6c84d0c (current diff) b71ba49473f4 (diff) |
children | c7f56bffe02f |
files | scripts/plot/draw/private/__quiver__.m scripts/plot/draw/quiver.m scripts/plot/draw/quiver3.m |
diffstat | 3 files changed, 55 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/draw/private/__quiver__.m Thu Dec 07 11:34:10 2017 -0500 +++ b/scripts/plot/draw/private/__quiver__.m Thu Dec 07 09:56:30 2017 -0800 @@ -149,10 +149,12 @@ hstate = get (hax, "nextplot"); unwind_protect - if (have_line_spec) ls = linespec.linestyle; lc = linespec.color; + if (isempty (lc)) + lc = __next_line_color__ (); + endif else ls = "-"; lc = __next_line_color__ (); @@ -230,9 +232,11 @@ endif ## Draw arrowhead as one line object + + ## Arrowhead is constructed, but NOT displayed, when marker is present. if (have_line_spec) if (! isempty (linespec.marker) && ! strcmp (linespec.marker, "none")) - ls = "none"; # No arrowhead drawn when marker present + ls = "none"; endif endif @@ -254,12 +258,14 @@ mk = linespec.marker; endif if (is3d) - h3 = plot3 (x, y, z, "linestyle", "none", "marker", mk, "parent", hg); + h3 = plot3 (x, y, z, "linestyle", "none", "color", lc, "marker", mk, + "parent", hg); else - h3 = plot (x, y, "linestyle", "none", "marker", mk, "parent", hg); + h3 = plot (x, y, "linestyle", "none", "color", lc, "marker", mk, + "parent", hg); endif if (have_filled) - set (h3, "markerfacecolor", get (h1, "color")); + set (h3, "markerfacecolor", lc); endif ## Set up the hggroup properties and listeners
--- a/scripts/plot/draw/quiver.m Thu Dec 07 11:34:10 2017 -0500 +++ b/scripts/plot/draw/quiver.m Thu Dec 07 09:56:30 2017 -0800 @@ -27,23 +27,26 @@ ## ## Plot a 2-D vector field with arrows. ## -## Plot the (@var{u}, @var{v}) components of a vector field in -## an (@var{x}, @var{y}) meshgrid. If the grid is uniform then @var{x} and -## @var{y} can be specified as vectors. +## 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. ## -## If @var{x} and @var{y} are undefined they are assumed to be +## If @var{x} and @var{y} are not given they are assumed to be ## @code{(1:@var{m}, 1:@var{n})} where ## @code{[@var{m}, @var{n}] = size (@var{u})}. ## -## The variable @var{s} is a scalar defining a scaling factor to use for -## the arrows of the field relative to the mesh spacing. A value of 0 +## The optional input @var{s} is a scalar defining a scaling factor to use for +## the arrows of the field relative to the mesh spacing. A value of 1.0 will +## result in the longest vector exactly filling one grid square. A value of 0 ## 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} -## of the same format as the @code{plot} command. -## If a marker is specified then markers at the grid points of the vectors are -## drawn rather than arrows. If the argument @qcode{"filled"} is given then -## the markers are filled. +## 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. ## ## If the first argument @var{hax} is an axes handle, then plot into this axis, ## rather than the current axes returned by @code{gca}. @@ -104,7 +107,20 @@ %! clf; %! [x,y] = meshgrid (1:2:20); %! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10)); -%! title ("quiver plot"); +%! title ("quiver() plot w/arrowheads (default)"); + +%!demo +%! clf; +%! [x,y] = meshgrid (1:2:20); +%! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10), "o"); +%! title ("quiver() plot w/origin markers"); + +%!demo +%! clf; +%! [x,y] = meshgrid (1:2:20); +%! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10)); +%! set (h, "marker", "o"); +%! title ("quiver() plot w/origin markers and arrowheads"); %!demo %! clf;
--- a/scripts/plot/draw/quiver3.m Thu Dec 07 11:34:10 2017 -0500 +++ b/scripts/plot/draw/quiver3.m Thu Dec 07 09:56:30 2017 -0800 @@ -27,22 +27,26 @@ ## ## Plot a 3-D vector field with arrows. ## -## Plot the (@var{u}, @var{v}, @var{w}) components of a vector field in -## an (@var{x}, @var{y}, @var{z}) meshgrid. If the grid is uniform then -## @var{x}, @var{y}, and @var{z} can be specified as vectors. +## 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 +## @code{meshgrid} is used to create the 3-D grid. ## -## If @var{x}, @var{y}, and @var{z} are undefined they are assumed to be -## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] = -## size (@var{u})} and @code{@var{p} = max (size (@var{w}))}. +## If @var{x}, @var{y}, and @var{z} are not given they are assumed to be +## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where +## @code{[@var{m}, @var{n}] = size (@var{u})} and +## @code{@var{p} = max (size (@var{w}))}. ## -## The variable @var{s} is a scalar defining a scaling factor to use for -## the arrows of the field relative to the mesh spacing. A value of 0 +## The optional input @var{s} is a scalar defining a scaling factor to use for +## the arrows of the field relative to the mesh spacing. A value of 1.0 will +## result in the longest vector exactly filling one grid cube. A value of 0 ## 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} -## of the same format as the @code{plot} command. -## If a marker is specified then markers at the grid points of the vectors are -## drawn rather than arrows. If the argument @qcode{"filled"} is given then +## 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}, @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. ## ## If the first argument @var{hax} is an axes handle, then plot into this axis, @@ -109,7 +113,7 @@ %! h = quiver3 (x, y, z, u, v, w); %! set (h, "maxheadsize", 0.25); %! hold off; -%! title ("quiver3 of surface normals to peaks() function"); +%! title ("quiver3() of surface normals to peaks() function"); %!demo %! clf; @@ -122,5 +126,5 @@ %! set (h, "maxheadsize", 0.25); %! hold off; %! shading interp; -%! title ({"quiver3 of surface normals to peaks() function"; ... +%! title ({"quiver3() of surface normals to peaks() function"; ... %! 'shading "interp"'});