How to add arrow to a line (like quiver)

조회 수: 325 (최근 30일)
Torkan
Torkan 2020년 2월 25일
댓글: Dariusz Maton 2023년 8월 30일
Hello,
Consider I have a smple line. I want to add arrow (for example 4 arrows to this line) and show it in plot. Is it possible?
x = [0,1,2,3];
y=[ 4,4,4,4]
plot(x,y)
Thnaks

채택된 답변

Sai Sri Pathuri
Sai Sri Pathuri 2020년 2월 28일
You may add marker ‘>’ to your plot. The below command plots the line with markers.
plot(x,y,'->')
If you specify only a marker symbol without a line style (as shown below), then plot displays only the markers with no line connecting them
plot(x,y,'>')
You may refer the following documentation to add markers
  댓글 수: 2
Brent F
Brent F 2021년 6월 22일
This does not draw an arrowhead pointing in the direction of the line. It only adds a right-pointing triangle symbol marker at each datapoint.
Dariusz Maton
Dariusz Maton 2023년 8월 30일
See my function arrowed_line, which adds arrowheads to the data of the line plot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by