How to insert arrows at the middle of each of the parallel lines

조회 수: 9 (최근 30일)
Atom
Atom 2020년 7월 7일
댓글: Atom 2020년 7월 8일
In the follwoing I want to insert arrows at the middle of each of the parallel lines
p = 0.01:.05:1;
figure(1)
plot([0; 1],[p; p], 'color','b');
x = [0.3,0.5];
y = [p,p+0.1];
a = annotation('arrow',x,y);
How to do that ? But my code does not work
  댓글 수: 3
Atom
Atom 2020년 7월 7일
편집: Atom 2020년 7월 7일
The example is like this. I have to draw parallel lines to x-axis and insert arrows like the fig in the middle of the each line.

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

채택된 답변

KSSV
KSSV 2020년 7월 8일
편집: KSSV 2020년 7월 8일
Why annotation for this? You can use quiver. Play around with the below code.
clc; clear all ;
p = 0.01:.05:1;
x =[0;1] ;
y = [p ;p] ;
x1 = repmat(0.5,1,20);
y1 = p ;
u1 = -0.2*ones(size(y1)) ;
v1 = zeros(size(x1)) ;
figure(1)
hold on
plot(x,y, 'color','b');
quiver(x1,p,u1,v1)
quiver(x1+0.1,p,u1,v1)
  댓글 수: 3
KSSV
KSSV 2020년 7월 8일
That would be tough using quiver...but you can try changing the width of the arrow, read the documentation.

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

추가 답변 (1개)

Mehmed Saad
Mehmed Saad 2020년 7월 7일
편집: Mehmed Saad 2020년 7월 7일
  댓글 수: 2
Atom
Atom 2020년 7월 7일
Thank you but it is not what I need. I have to draw parallel lines to x-axis and insert arrows like the fig in the middle of the each line as shown in the fig above.
Mehmed Saad
Mehmed Saad 2020년 7월 8일
use FEX file arrow. It is easy to use.

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

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by