フィルターのクリア

How to plot data with classes

7 ビュー (過去 30 日間)
Kong
Kong 2020 年 4 月 13 日
コメント済み: KSSV 2020 年 4 月 13 日
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');

採用された回答

KSSV
KSSV 2020 年 4 月 13 日
  2 件のコメント
Kong
Kong 2020 年 4 月 13 日
Thank you!
I got this figure. How can I change legend 1~6 to (A,B,C,D,E,F)?
clear all
close all
X = csvread('kth_hog.csv');
Y = csvread('kth_hog_class.csv');
gscatter(X(:,1),X(:,2),Y);
KSSV
KSSV 2020 年 4 月 13 日
You can chnage the name of class to what you want.....read doc....it is given out there.

サインインしてコメントする。

その他の回答 (1 件)

David Hill
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');
  1 件のコメント
Kong
Kong 2020 年 4 月 13 日
Thank you so much.
I got the error. X and Y have different length's vector.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by