horizontal boxplot with data dots on it and different colors
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Dyuman Joshi
2023 年 10 月 11 日
When you change the orientation, do you want to change the xticks, yticks, xlabel and ylabel as well?
採用された回答
Voss
2023 年 10 月 31 日
%% 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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

