Formatting quiver() arrows

67 Ansichten (letzte 30 Tage)
Felipe  Schuback
Felipe Schuback am 10 Aug. 2017
Beantwortet: José-Luis am 10 Aug. 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.

Antworten (2)

Walter Roberson
Walter Roberson am 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 '-'

José-Luis
José-Luis am 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';

Kategorien

Mehr zu Vector Fields finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by