Formatting quiver() arrows

65 次查看(过去 30 天)
Felipe  Schuback
Felipe Schuback 2017-8-10
回答: José-Luis 2017-8-10
Hi all - I plotted a quiver arrow to join two points in my scatter plot and the formatting of this arrow is really important to get my task done. When I tried to, for example, format the LineStyle to '--' (dashed), the arrow head also became dashed. Is it possible to format the arrow stem only? I would like to format the arrow stem (dashed, etc) but maintaining the arrow head line style as solid line. Is this possible in any way?
Besides that, how do I choose the direction of the arrow in quiver plot?
Appreciate the help very much.

回答(2 个)

Walter Roberson
Walter Roberson 2017-8-10
Yes, it turns out to be possible using undocumented properties.
h = quiver(...., 'LineStyle', '--') %use the linestyle appropriate for the body
h.Head.LineStyle = 'solid'; %magic property, magic property value, notice this is not '-'

José-Luis
José-Luis 2017-8-10
If you wanna go kosher:
data = rand(10,4);
qH = quiver(data(:,1),data(:,2),data(:,3),data(:,4),0);
hold on
qH1 = quiver(data(:,1),data(:,2),data(:,3),data(:,4),0);
qH2 = quiver(data(:,1),data(:,2),data(:,3),data(:,4),0);
colorVector = rand(1,3);
qH.LineStyle = '-';
qH.Color = colorVector;
qH1.LineStyle = '-';
qH1.Color = 'w';
qH1.ShowArrowHead = 'off';
qH2.LineStyle = '--';
qH2.Color = colorVector;
qH2.ShowArrowHead = 'off';

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by