plotting multiple vertical lines on a graph

2 ビュー (過去 30 日間)
C.G.
C.G. 2021 年 10 月 25 日
コメント済み: C.G. 2021 年 10 月 25 日
Im currently using the code below to plot vertical lines on my graph at 0.5 intervals, but I want to change this to plot at every 0.25 intervals. It seems long winded to do this in this way, is there a more efficient way to do this?
figure(1)
cla;
scatter(x(:,a),y(:,a))
xlabel('X Coordinates')
ylabel('Y Coordinates')
title('Particle locations in the rice pile')
set(gca, 'XDir','reverse')
xline(0.08);
xline(0.085);
xline(0.09);
xline(0.095);
xline(0.1);
xline(0.105);
xline(0.11);
xline(0.115)
xline(0.12);
xline(0.125);
xline(0.13);
xline(0.135);
xline(0.14);
xline(0.145);
xline(0.15);

採用された回答

KSSV
KSSV 2021 年 10 月 25 日
figure(1)
cla;
scatter(x(:,a),y(:,a))
xlabel('X Coordinates')
ylabel('Y Coordinates')
title('Particle locations in the rice pile')
set(gca, 'XDir','reverse')
L = 0.085:0.025:0.15 ;
for i = 1:length(L)
xline(L(i));
end
  1 件のコメント
C.G.
C.G. 2021 年 10 月 25 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDirected Graphs についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by