Formatting quiver() arrows
69 views (last 30 days)
Show older comments
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.
0 Comments
Answers (2)
Walter Roberson
on 10 Aug 2017
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 '-'
0 Comments
José-Luis
on 10 Aug 2017
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';
0 Comments
See Also
Categories
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!