Control quiver arrow head width vs height.
28 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have a quiver plot where the arrow heads are incredibly wide by default, so I used "MaxHeadSize" to shrink them to a reasonable size. Also, the scaling behavior is set to 0 because I want them to connect the way they do currently. The downside is that now, instead of looking like arrowheads, they almost look like horizontal bars. I'm wondering if there is a way to control the head length independently of the head width.
3 件のコメント
Mathieu NOE
2024 年 9 月 12 日
seems this kind of topic has been already addressed in this forum, in some ways ... adapt to your needs
etc...
回答 (1 件)
Sreeram
2024 年 9 月 16 日
編集済み: Sreeram
2024 年 9 月 16 日
Hi Patrick,
This is happening because the range of X- and Y-coordinates differ significantly. The arrow heads are scaled in relation to the range of axes.
Although I could not find any way to adjust arrow’s head length independent of head width, you can follow the workaround by the MathWorks Support Team here:
Here’s how I implemented it:
scale_factor = range(Y)/range(X);
q2b = quiver(Y, X*scale_factor, V, U*scale_factor, 0);
q2b.Marker = "*";
ytlbls=Q2B.YTickLabel;
ytlbls=cellfun(@(c)str2double(c)/scale_factor,ytlbls);
set(Q2B,'YTickLabel',ytlbls)
Here’s a comparison of before and after for the second subplot (which had arrows appearing as horizontal line):
Before
After
I hope it helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Vector Fields についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!