How can I change quiver width (MaxHeadSize don't work for width)?

17 ビュー (過去 30 日間)
Angelo Hafner
Angelo Hafner 2020 年 1 月 8 日
回答済み: Angelo Hafner 2020 年 1 月 11 日
The code bellow
clearvars;
x = linspace(0,100,5);
y = x/100;
[x,y] = meshgrid(x,y);
u = x;
v = 0*x;
quiver(x,y,u,v);
generates the figure
I would like to reduce the arrow width and enlarge arrow length. This happens every time that the scale of x and y are different.
I already tried MaxHeadSize propriety, but it did not work as I would like.
Thank's in advance.

採用された回答

Angelo Hafner
Angelo Hafner 2020 年 1 月 11 日
Unfortunately that's not what I expect from MATLAB.
I really hope these formatting options will be reviewed in future releases.
The answer was the best within MATLAB's capabilities.
Thank you!

その他の回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 1 月 8 日
編集済み: Cris LaPierre 2020 年 1 月 8 日
maxHeadSize worked for me. Perhaps try setting it this way?
q=quiver(x,y,u,v);
q.MaxHeadSize = 0.01;
For length of the arrow, the following options are given in the documentation:
"quiver(...,scale) automatically scales the arrows to fit within the grid and then stretches them by the factor scale. scale = 2 doubles their relative length, and scale = 0.5 halves the length. Use scale = 0 to plot the velocity vectors without automatic scaling. You can also tune the length of arrows after they have been drawn by choosing the Plot Edit tool, selecting the quiver object, opening the Property Editor, and adjusting the Length slider."
  2 件のコメント
Angelo Hafner
Angelo Hafner 2020 年 1 月 9 日
編集済み: Angelo Hafner 2020 年 1 月 9 日
I tried your suggestion (code bellow)
clearvars;
x = linspace(0,100,5);
y = x/100;
[x,y] = meshgrid(x,y);
u = x;
v = 0*x;
q=quiver(x,y,u,v);
q.MaxHeadSize = 0.01;
I got the figure. The arrows still very ugly :( .... Would you have any suggestions for improving the look of these arrows? Thank's in advance.
Cris LaPierre
Cris LaPierre 2020 年 1 月 9 日
Unfortunately, quiver has very few formatting options (listed here).
It is possible to use annotation arrows instead, though of course it is more cumbersome. Their properties are visible here.

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

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by