Skip to content

Commit 217c212

Browse files
updateQuiver: broadcast scalar XData/YData/ZData from MATLAB no-coords quiver
1 parent 8113cb3 commit 217c212

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

plotly/plotlyfig_aux/handlegraphics/updateQuiver.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,20 @@
1515
wDataRaw = get(plotData, 'WData');
1616

1717
%-one arrow per element: vector inputs pair up x/y/u/v directly,
18-
%-matrix inputs are full grids of matching shape-%
18+
%-matrix inputs are full grids of matching shape. MATLAB's
19+
%-no-coords quiver (quiver(u,v)) stores scalar defaults (YData = 1)
20+
%-that the primitive broadcasts internally - replicate that here.-%
1921
if isvector(xData) && isvector(uDataRaw)
2022
nArrows = numel(uDataRaw);
23+
if numel(xData) == 1
24+
xData = xData * ones(size(uDataRaw));
25+
end
26+
if numel(yData) == 1
27+
yData = yData * ones(size(uDataRaw));
28+
end
29+
if numel(zData) == 1
30+
zData = zData * ones(size(uDataRaw));
31+
end
2132
else
2233
if isvector(xData)
2334
[xData, yData] = meshgrid(xData, yData);

0 commit comments

Comments
 (0)