Customize scatter figure with subplot

11 ビュー (過去 30 日間)
Alejandro Fernández
Alejandro Fernández 2020 年 11 月 11 日
コメント済み: Ameer Hamza 2020 年 11 月 11 日
Hi, I have the following code that generates a plot like this:
close all; clc
labels = {'K_p' 'K_d' 'K_i' 'M_p'};
data = rand(7,4);
cmap = lines(7);
for i = 1 : 3
subplot(2,3,i)
scatter(data(:,i),data(:,4),[],cmap,'filled')
end
data = rand(7,4);
for i = 1 : 3
subplot(2,3,i+3)
scatter(data(:,i),data(:,4),[],cmap,'filled')
end
And I need to modify it to create something like this:
And I would also like all the axes to be as close as possible to each other

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 11 日
編集済み: Ameer Hamza 2020 年 11 月 11 日
Try this
close all; clc
labels = {'K_p' 'K_d' 'K_i'};
cmap = lines(7);
data = rand(7,4);
for i = 1 : 3
subplot(2,3,i);
scatter(data(:,i),data(:,4),[],cmap,'filled');
if i == 1
ylabel('ts', 'FontSize', 22);
end
if i > 1
yticklabels([]);
end
end
data = rand(7,4);
for i = 1 : 3
subplot(2,3,i+3)
scatter(data(:,i),data(:,4),[],cmap,'filled');
if i == 1
ylabel('M_p', 'FontSize', 22);
end
xlabel(labels{i}, 'FontSize', 22);
if i > 1
yticklabels([]);
end
end
  4 件のコメント
Alejandro Fernández
Alejandro Fernández 2020 年 11 月 11 日
Yes, perfec, thank you so much!
Ameer Hamza
Ameer Hamza 2020 年 11 月 11 日
I am glad to be of help!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by