フィルターのクリア

How can I use different markers regarding data labels in a plot?

3 ビュー (過去 30 日間)
FATIH GUNDOGAN
FATIH GUNDOGAN 2021 年 4 月 17 日
回答済み: FATIH GUNDOGAN 2021 年 4 月 17 日
Hello I want to use 'x' or 'o' in the plot regarding the value of each elemants in T.
so if point (1,3) is labeled with 0, I'll put 'o'
if point (1,3) is labeled with 1, I'll put 'x'
if point (1,3) is labeled with 2, I'll put 'r'
How can that be possible?
clc;clear;
data = load('test_data.txt');
sample_size = size(data,1);
X=[ones(sample_size,1) data(:,1) data(:,2)]'; %Each coloumn is a sample
T = data(:,3)'; % Labels for each sample
plot(X(2,:),X(3,:),'x', 'MarkerFaceColor', [0.2, 0.2, 0.5], 'MarkerEdgeColor', 'k', 'MarkerSize', 7)
title('Plot of test data')
grid on;
xlabel('x1');
ylabel('x2');

回答 (1 件)

FATIH GUNDOGAN
FATIH GUNDOGAN 2021 年 4 月 17 日
That's how I workarounded...
figure
scatter(X(2,:),X(3,:),sample_size,T, 'filled')
% Add title and axis labels
title('Plot of training data')
xlabel('x1')
ylabel('x2')

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by