I want to put arrows on each of the lines parallel to x-axis using LOOP

7 次查看(过去 30 天)
I want to put arrows on each of the lines parallel to x-axis using LOOP
Here I am able to put one arrow. Using
q = 0.2:.2:1;
xx = [0.56 0.57]; % adjust length and location of arrow
yy = [q q];
I failed to get the desired arrows. How to modify the code below to get arrows on each blue lines.
p = 0.02:.07:1;
plot([0; 1],[p; p], 'color','b');
%q = 0.2:.2:1;
xx = [0.56 0.57]; % adjust length and location of arrow
yy = [0.9 0.9];
annotation('textarrow',xx,yy,'FontSize',13,'Linewidth',2)
xlabel('$x\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
ylabel('$y\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
axis([0 1 0 .5]);

采纳的回答

Alan Stevens
Alan Stevens 2022-11-8
Like this?
p = 0.02:.07:1;
plot([0; 1],[p; p], 'color','b');
hold on
%q = 0.2:.2:1;
xx = [0.5 0.57]; % adjust length and location of arrow
ly = 0.15; d = 0.0555;
for i=1:numel(p)
yy = [ly ly];
ly = ly+d;
annotation('textarrow',xx,yy,'FontSize',13,'Linewidth',2)
end
xlabel('$x\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
ylabel('$y\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by