How to plot data with classes
20 次查看(过去 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.
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!