필터 지우기
필터 지우기

Plot points without connect it

조회 수: 101 (최근 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 CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by