Is it possible to modify the size of the arrow heads drawn by streamslice.m?

33 ビュー (過去 30 日間)
I have 2-d arrays of x- and y-direction velocities (u,v). My code includes the line:
h=streamslice(u,v,7);
I would like the arrow heads that are drawn to be larger (and thus more visible).
I have only found suggestions for quiver, not streamslice.
Thanks

採用された回答

Salman Ahmed
Salman Ahmed 2021 年 9 月 3 日
Hi John,
There is a difference between quiver and streamslice that quiver returns a Quiver object while streamslice returns a vector of handles to the line objects. These line objects represent lines and arrows in the figure. Like any line object, the arrow properties can be modified to change Color, LineWidth, etc. Have a look at the sample code to understand better:
load wind;
s = numel(streamslice(x,y,z,u,v,w,[],[],5,'noarrows')); % number of lines only (no arrows) in streamslice
close all; % close the figure
ssobj=streamslice(x,y,z,u,v,w,[],[],5); % Open again with arrows
for i=s+1:numel(ssobj) % Iterate over the line objects pertaining to arrows
ssobj(i).LineWidth=2; % Adjust LineWidth to make arrows more visible.
end
You can try replacing your streamslice function in the above code snippet and adjust LineWidth value to suit the size of arrowhead you need.
  1 件のコメント
John Toole
John Toole 2021 年 9 月 6 日
Thank you for the suggestion. This gets me 90% of what I was wanting to achieve. It would be a bit nicer if I could also control the size of the arrows in addition to how thick they are displayed. LineWidth=3 results in the arrows looking like equilateral triangles rather than arrows. LineWidth=2 is okay, but not best.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by