horizontal boxplot with data dots on it and different colors
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hossein Mohamadi
el 11 de Oct. de 2023
Respondida: Voss
el 31 de Oct. de 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 comentarios
Hossein Mohamadi
el 11 de Oct. de 2023
Editada: Dyuman Joshi
el 11 de Oct. de 2023
Dyuman Joshi
el 11 de Oct. de 2023
When you change the orientation, do you want to change the xticks, yticks, xlabel and ylabel as well?
Respuesta aceptada
Voss
el 31 de Oct. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Distribution Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!