horizontal boxplot with data dots on it and different colors
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hossein Mohamadi
am 11 Okt. 2023
Beantwortet: Voss
am 31 Okt. 2023
could some one creat a matlab code for horizontal boxplot with data dots on it and different colors for 2 groups? similar to attached
3 Kommentare
Hossein Mohamadi
am 11 Okt. 2023
Bearbeitet: Dyuman Joshi
am 11 Okt. 2023
Dyuman Joshi
am 11 Okt. 2023
When you change the orientation, do you want to change the xticks, yticks, xlabel and ylabel as well?
Akzeptierte Antwort
Voss
am 31 Okt. 2023
%% Learning rate
clc; clear all; close all
y1 = [1.06 1.1 0.89 0.96 0.95 1 0.76 1.41 0.97 0.75 0.83 0.76 0.79 1.31 1.08 0.83]';
y2 = [1.16 1.07 1.13 1 1.01 1 0.87 1.42 1.26 0.86 0.95 0.9 1.02 1.22 1.19 0.86]';
y3 = [1.2 1.15 1.16 0.97 1.14 1 0.98 1.14 1.51 0.93 1.03 0.9 1 1.28 1.39 0.93]';
allData = {y1; y2; y3};
group = [ ones(size(y1));
2 * ones(size(y2))
3 * ones(size(y3))];
h = boxplot(cell2mat(allData),group,'Orientation','horizontal'), title('Learning Rate Across Different Memory Load','FontSize',20);
set(h, 'linewidth' ,2)
%% FontSize has been reduced to get a proper view of the figure
set(gca,'YTickLabel', {'2 Letters'; '4 Letters'; '6 Letters'},'FontSize',12)
xlabel('Response Time (Seconds)','FontSize',12);
hold on
xCenter = 1:numel(allData);
spread = 0.5; % 0=no spread; 0.5=random spread within box bounds (can be any value)
for i = 1:numel(allData)
plot(allData{i}, rand(size(allData{i}))*spread -(spread/2) + xCenter(i), 'mo','linewidth', 2)
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Distribution Plots 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!

