How to Plot 1D Graph?

I want to plot a vertical or horizontal 1D graph. I have A = [22 23 24] and B = [5 6 7]. I want to represent these as discrete points along a single line, with the colors of points A and B different. Any suggestions please?

1 件のコメント

Dyuman Joshi
Dyuman Joshi 2023 年 11 月 24 日
Did you mean a 2D graph?
As a line is a 2D object.

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

回答 (2 件)

KSSV
KSSV 2016 年 6 月 24 日

0 投票

A = [22 23 24] ;
B = [5 6 7] ;
plot(A,'-or') ;
hold on
plot(B,'-Ob') ;
legend({'A' ; 'B'})

3 件のコメント

Jasnoor Singh
Jasnoor Singh 2016 年 6 月 24 日
Thanks for your response. But this is still a 2D graph. I want to represent all this along a single line.
KSSV
KSSV 2016 年 6 月 24 日
How you can represent? If you want to show variation of A and B, you have to put other dimension. Do you have any rough idea in mind? Draw using paint and attach.
van hai dang
van hai dang 2019 年 12 月 24 日
thank you for your support. I do not make the x axis like this, I would like to change values x axis to X1 X2 X3 according to yaxis value. Do you know how to do it. thank you

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

Arooj
Arooj 2023 年 2 月 26 日

0 投票

A=[22 23 24]; B=[5 6 7]; plot(A,'-or'); hold on plot(B,'-0b'); legend({'A';'B'})

1 件のコメント

Jens Peder Ulfkjær
Jens Peder Ulfkjær 2023 年 11 月 24 日
It is still a 2D plot

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

カテゴリ

ヘルプ センター および File ExchangeLine Plots についてさらに検索

タグ

質問済み:

2016 年 6 月 24 日

コメント済み:

2023 年 11 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by