필터 지우기
필터 지우기

scatter plot for plotting categorical data

조회 수: 2 (최근 30일)
Kiruthiga Sekar
Kiruthiga Sekar 2019년 2월 13일
댓글: ibabinaca 2019년 2월 14일
Hi,
I have a matrix in which the second row randomnly has 0s and 1s. How do I plot them with different colours and in the same scatter plot?
Thanks in Advance
  댓글 수: 3
Kiruthiga Sekar
Kiruthiga Sekar 2019년 2월 14일
10 20 30 40 50
0 1 0 0 1
i need to plot 0s with one color and 1s with other color in the same scatter plot
ibabinaca
ibabinaca 2019년 2월 14일
The fourth argument in scatter has to do with the color of the circle.https://es.mathworks.com/help/matlab/ref/scatter.html?lang=en.
Since y is a matrix with 0 and 1, if you just put y as the fourth argument it's enough.
x =[10 20 30 40 50];
y = [0 1 0 0 1];
scatter(x,y,50,y,'filled')

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

답변 (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