How to add arrow to a line (like quiver)

304 visualizaciones (últimos 30 días)
Torkan
Torkan el 25 de Feb. de 2020
Comentada: Dariusz Maton el 30 de Ag. de 2023
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

Respuesta aceptada

Sai Sri Pathuri
Sai Sri Pathuri el 28 de Feb. de 2020
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 comentarios
Brent F
Brent F el 22 de Jun. de 2021
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 el 30 de Ag. de 2023
See my function arrowed_line, which adds arrowheads to the data of the line plot.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by