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 comentario

Dyuman Joshi
Dyuman Joshi el 24 de Nov. de 2023
Did you mean a 2D graph?
As a line is a 2D object.

Iniciar sesión para comentar.

Respuestas (2)

KSSV
KSSV el 24 de Jun. de 2016

0 votos

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

3 comentarios

Jasnoor Singh
Jasnoor Singh el 24 de Jun. de 2016
Thanks for your response. But this is still a 2D graph. I want to represent all this along a single line.
KSSV
KSSV el 24 de Jun. de 2016
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 el 24 de Dic. de 2019
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

Iniciar sesión para comentar.

Arooj
Arooj el 26 de Feb. de 2023

0 votos

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

Categorías

Más información sobre Line Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 24 de Jun. de 2016

Comentada:

el 24 de Nov. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by