Add x=y line to the scatter plot

162 ビュー (過去 30 日間)
Gokhan Kayan
Gokhan Kayan 2021 年 11 月 9 日
コメント済み: Gokhan Kayan 2021 年 11 月 9 日
Hi, I have x and y data, where
x=[396.23;357.07;433.30;404.39;439.9;351.06;491.61;563.21;418.79;441.74;370.58;503.24;540.9;441.07;418.88;555.11;473.21;390.62];
y=[389.49;337.59;441.35;371.53;369.68;329.63;507.16;542.65;428.09;444.03;337.93;522.72;521.950;481.62;430.72;515.48;423.49;372.48];
scatter(x,y)
xlim([300 600])
ylim([300 600])
pbaspect([1 1 1])
How can I draw x=y line to this plot ? Is there any command to this ?

採用された回答

dpb
dpb 2021 年 11 月 9 日
hold on
plot(xlim,ylim,'-b')
  1 件のコメント
Gokhan Kayan
Gokhan Kayan 2021 年 11 月 9 日
Thanks. It worked perfectly

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

その他の回答 (1 件)

Sargondjani
Sargondjani 2021 年 11 月 9 日
x = linspace(300,600,2);
y = x;
plot(x,y)
And you will need a hold command after the scatter command.
  1 件のコメント
Gokhan Kayan
Gokhan Kayan 2021 年 11 月 9 日
Thanks for the answeer dear Sargondjani. It worked perfectly too

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

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by