# HG changeset patch # User Nicholas R. Jankowski # Date 1683560981 14400 # Node ID 7dcb6b4a4218374d501e029746a5398457effd13 # Parent 4e30fd19211807a9ac64b9a08767bf1afb42bfed quiver: Marker & arrowhead name/value property style consistency (bug #64134) * __quiver__.m: Add have_line_spec check after applying any name-value properties to maintain arrowhead display status. * __quiver__.m (update_plot): Add linewidth property to base marker object set call. * quiver.m: Add BIST to ensure marker properties are updated correctly. Remove unnecessary strcmp from other BIST assert calls. * etc/NEWS.9.md: Update description of changes to quiver note under General Improvements. diff -r 4e30fd192118 -r 7dcb6b4a4218 etc/NEWS.9.md --- a/etc/NEWS.9.md Sun May 07 18:15:23 2023 +0200 +++ b/etc/NEWS.9.md Mon May 08 11:49:41 2023 -0400 @@ -20,12 +20,15 @@ backward compatibility, except that non-integer inputs will no longer error. - `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. +internally recasting them to 'double' (bug #59695). Both functions now +honor a previously ignored scaling factor input when there is only a +single arrow (bug #39552), and `quiver3` no longer produces 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. +When a linestyle with a base marker is set suppressing arrowhead display, +subsequent name-value property pairs in the quiver/quiver3 function call +will no longer turn arrowhead display back on (bug #64143). The linewdith +property now also affect the line width of the base marker. - The `inputParser` function has been re-architected for a 60% performance improvement. diff -r 4e30fd192118 -r 7dcb6b4a4218 scripts/plot/draw/private/__quiver__.m --- a/scripts/plot/draw/private/__quiver__.m Sun May 07 18:15:23 2023 +0200 +++ b/scripts/plot/draw/private/__quiver__.m Mon May 08 11:49:41 2023 -0400 @@ -379,6 +379,10 @@ if (! isempty (args)) set (hg, args{:}); + if (have_line_spec && ! isempty (linespec.marker) && ... + ! strcmp (linespec.marker, "none")) + set (h2, "linestyle", "none"); + endif endif unwind_protect_cleanup @@ -497,7 +501,8 @@ set (kids([3 2]), {"color", "linestyle", "linewidth"}, get (h, {"color", "linestyle", "linewidth"})); set (kids(2), "visible", get (h, "showarrowhead")); - set (kids(1), {"color", "marker", "markerfacecolor", "markersize"}, - get (h, {"color", "marker", "markerfacecolor", "markersize"})); + set (kids(1), {"color", "marker", "markerfacecolor", "markersize", ... + "linewidth"}, get (h, {"color", "marker", "markerfacecolor", ... + "markersize", "linewidth"})); endfunction diff -r 4e30fd192118 -r 7dcb6b4a4218 scripts/plot/draw/quiver.m --- a/scripts/plot/draw/quiver.m Sun May 07 18:15:23 2023 +0200 +++ b/scripts/plot/draw/quiver.m Mon May 08 11:49:41 2023 -0400 @@ -369,89 +369,124 @@ %! unwind_protect %! h = quiver (hax, 0, 1, 2, 3, "-o"); # Linestyle %! parent = get (h); -%! assert (strcmp (parent.marker, "o")); -%! assert (strcmp (parent.markerfacecolor, "none")); +%! assert (parent.marker, "o"); +%! assert (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")); +%! assert (childdata(basechild).marker, "o"); +%! assert (childdata(basechild).markerfacecolor, "none"); +%! assert (childdata(basechild).linestyle, "none"); +%! assert (childdata(arrowheadchild).marker, "none"); +%! assert (childdata(arrowheadchild).markerfacecolor, "none"); +%! assert (childdata(arrowheadchild).linestyle, "none"); %! %! h = quiver (hax, 0, 1, 2, 3, "-o", "filled"); # Linestyle + filled. %! parent = get (h); -%! assert (strcmp (parent.marker, "o")); +%! assert (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 (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")); +%! assert (childdata(basechild).linestyle, "none"); +%! assert (childdata(arrowheadchild).marker, "none"); +%! assert (childdata(arrowheadchild).markerfacecolor, "none"); +%! assert (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.marker, "none"); +%! assert (parent.markerfacecolor, "none"); +%! assert (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(basechild).marker, "none"); +%! assert (childdata(basechild).markerfacecolor, "none"); +%! assert (childdata(basechild).linestyle, "none"); +%! assert (childdata(stemchild).marker, "none"); +%! assert (childdata(stemchild).markerfacecolor, "none"); +%! assert (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).marker, "none"); +%! assert (childdata(arrowheadchild).markerfacecolor, "none"); +%! assert (childdata(arrowheadchild).linestyle, "-"); %! assert (childdata(arrowheadchild).linewidth, 10); %! %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect -## Test both Linestyle + name/value pair -%!test <64143> +## Test both Linestyle with marker + name/value pair suppress arrowhead +%!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.marker, "o"); +%! assert (parent.markerfacecolor, "none"); +%! assert (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(basechild).marker, "o"); +%! assert (childdata(basechild).markerfacecolor, "none"); +%! assert (childdata(basechild).linestyle, "none"); +%! assert (childdata(stemchild).marker, "none"); +%! assert (childdata(stemchild).markerfacecolor, "none"); +%! assert (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).marker, "none"); +%! assert (childdata(arrowheadchild).markerfacecolor, "none"); +%! assert (childdata(arrowheadchild).linestyle, "none"); %! assert (childdata(arrowheadchild).linewidth, 10); %! %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect +## Test that linewidth and color but not linestyle are passed to base marker +%!test <*64143> +%! hf = figure ("visible", "off"); +%! hax = gca(); +%! unwind_protect +%! h = quiver (hax, 0, 1, 2, 3, "--o", "linewidth", 10, "color", [1 0 0]); +%! parent = get (h); +%! assert (parent.marker, "o"); +%! assert (parent.markerfacecolor, "none"); +%! assert (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 (childdata(basechild).marker, "o"); +%! assert (childdata(basechild).markerfacecolor, "none"); +%! assert (childdata(basechild).linestyle, "none"); +%! assert (childdata(basechild).color, [1 0 0]); +%! assert (childdata(basechild).linewidth, 10); +%! assert (childdata(stemchild).marker, "none"); +%! assert (childdata(stemchild).markerfacecolor, "none"); +%! assert (childdata(stemchild).linestyle, "--"); +%! assert (childdata(stemchild).linewidth, 10); +%! assert (childdata(stemchild).color, [1 0 0]); +%! assert (childdata(arrowheadchild).marker, "none"); +%! assert (childdata(arrowheadchild).markerfacecolor, "none"); +%! assert (childdata(arrowheadchild).linestyle, "none"); +%! assert (childdata(arrowheadchild).linewidth, 10); +%! assert (childdata(arrowheadchild).color, [1 0 0]); +%! +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + ## Check arrow length, scale factor adjustment, one arrow. %!test <*39552> %! hf = figure ("visible", "off");