Formatting quiver() arrows

65 vues (au cours des 30 derniers jours)
Felipe  Schuback
Felipe Schuback le 10 Août 2017
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.

Réponses (2)

Walter Roberson
Walter Roberson le 10 Août 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 '-'

José-Luis
José-Luis le 10 Août 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';

Catégories

En savoir plus sur Vector Fields dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by