How to plot data with classes
조회 수: 7 (최근 30일)
이전 댓글 표시
Hello.
I'm a beginner in Matlab.
I want to plot data with classes.
X = 1305 x 6
Y = 1305 x 1 (class : 0,1,2,3,4,5,6)
Could I get an idea to plot this data with legend?
I want to get this kind of picture.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/284026/image.png)
clear all
close all
X = csvread('data.csv');
Y = csvread('class.csv');
댓글 수: 0
채택된 답변
추가 답변 (1개)
David Hill
2020년 4월 13일
It is unclear what you are going to use as your x,y coordinates in your data set.
lookup='rgbymck';
c=lookup(Y+1);%convert 0-6 to colors
scatter(x,y,c,'filled');
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!