필터 지우기
필터 지우기

plotting same values as individual points on x-axis

조회 수: 5 (최근 30일)
Sumera Yamin
Sumera Yamin 2023년 11월 9일
댓글: Sumera Yamin 2023년 11월 10일
Hello, I want to plot a data in which x coordinate has multiple point waith same values and i want to keep those values as individual points. What will be the best way to do so. for example I have data in the following format in which x-coordiate values are repeated as a series but i want to keep them as individual points and not have just five points in x-coordinate. many thanks.
x=[1,2,3,4,5,1,2,3,4,5,1,2,3,4,5]
y=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
  댓글 수: 2
Dyuman Joshi
Dyuman Joshi 2023년 11월 9일
It's not clear to me what exactly you want to obtain. What should be the output for the given data?
"but i want to keep them as individual points and not have just five points in x-coordinate."
Could you elaborate on this?
Sumera Yamin
Sumera Yamin 2023년 11월 9일
yes, i want to plot from 1-5 on x-axis not just one time but three times as they appear in the data. If i use simple plot, it will have fivr points on x-axis and not a series.

댓글을 달려면 로그인하십시오.

채택된 답변

Dyuman Joshi
Dyuman Joshi 2023년 11월 9일
x=[1,2,3,4,5,1,2,3,4,5,1,2,3,4,5];
y=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
vec = 1:numel(y);
scatter(vec,y)
xticks(vec)
xticklabels(string(x))
  댓글 수: 1
Sumera Yamin
Sumera Yamin 2023년 11월 10일
Many thanks. This is precisely what i wanted but I have one question. in command line "vec = 1:numel(y);", you made variable vec with the values in y and plotted scatter between vec and y, where does values of x comes from in this code? Should the scatter be between (x,y) instead of (vec,y)?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by