Skip to content

Commit

Permalink
Merge pull request #338 from plotly/issue254
Browse files Browse the repository at this point in the history
Issue254
  • Loading branch information
gilbertogalvis authored Aug 13, 2021
2 parents 8813265 + 768948c commit 7c90450
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions plotly/plotlyfig_aux/handlegraphics/updateQuiver.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
col = 255*quiver_data.Color;
obj.data{quiverIndex}.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];

%------------------------------------------------------------------------%

%-quiver line width-%
obj.data{quiverIndex}.line.width = 2 * quiver_data.LineWidth;

Expand Down Expand Up @@ -115,6 +117,32 @@
m = m + 3;
end

%------------------------------------------------------------------------%

%-quiver z-%

% check for 3D plot
flag3d = ~isempty(quiver_data.ZData);

if flag3d

%-format data-%
zdata = quiver_data.ZData(:);
wdata = quiver_data.WData(:)*scalefactor;

%-set 3d data-%
m = 1;
for n = 1:length(ydata)
obj.data{quiverIndex}.z(m) = zdata(n);
obj.data{quiverIndex}.z(m+1) = zdata(n) + wdata(n);
obj.data{quiverIndex}.z(m+2) = nan;
m = m + 3;
end

%-scatter 3d type-%
obj.data{quiverIndex}.type = 'scatter3d';
end

%-------------------------------------------------------------------------%

%-quiver barbs-%
Expand Down Expand Up @@ -154,6 +182,10 @@
for col = 1:4
obj.data{quiverIndex}.x(end+1) = barb(1,col); % point 1
obj.data{quiverIndex}.y(end+1) = barb(2,col);

if flag3d
obj.data{quiverIndex}.z(end+1) = zdata(n);
end
end
end
end
Expand Down

0 comments on commit 7c90450

Please sign in to comment.