![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410355/image.png)
Customize scatter figure with subplot
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Alejandro Fernández
am 11 Nov. 2020
Kommentiert: Ameer Hamza
am 11 Nov. 2020
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410280/image.png)
And I need to modify it to create something like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410285/image.png)
And I would also like all the axes to be as close as possible to each other
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 11 Nov. 2020
Bearbeitet: Ameer Hamza
am 11 Nov. 2020
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410355/image.png)
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!