Plot points without connect it

210 ビュー (過去 30 日間)
Ali Kareem
Ali Kareem 2015 年 10 月 29 日
編集済み: Hannes Morgenroth 2020 年 10 月 15 日
Hi
I have matrix A(20,100) and I want to plot first column with respect to second column but I do not want to connect the points together. I mean I just want to put these point on the graph I used
plot(A(:,1),A(:,2))
but this command connect points together
How I can do that?
Regards

採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 30 日
scatter(A(:,1),A(:,2))
  3 件のコメント
Walter Roberson
Walter Roberson 2015 年 10 月 30 日
scatter() creates a single graphics handle. You can go ahead and legend() passing in multiple legend entries. For example,
plot(A(:,1), fitted_values);
hold on
scatter(A(:,1), A(:,2));
legend({'Fitted', 'Raw Data'})
Note: if you want different legends for different points you will need to use multiple scatter() calls.
Ali Kareem
Ali Kareem 2015 年 10 月 30 日
Thank you!

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

その他の回答 (2 件)

Hazem
Hazem 2017 年 12 月 5 日
plot(A(:,1),A(:,2), 'o')
or whatever marker you want to use

Daniel Malo Osorio
Daniel Malo Osorio 2020 年 4 月 29 日
Follow-up question
How do I make it possible to plot with lines conecting my dots with the plot() function?
I have tried using the 'r.-' marker, but it ONLY plots the dots on the figure.
assuming x and y are my data vectors
plot(x,y,".-r")
  1 件のコメント
Hannes Morgenroth
Hannes Morgenroth 2020 年 10 月 15 日
編集済み: Hannes Morgenroth 2020 年 10 月 15 日
I always use hold and plot on top without a marker.
Example:
plot(x,y,".-r")
hold all;
plot(x,y)

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by