Plot two or more multcompare results vertically in one figure

2 次查看(过去 30 天)
Hello,
The multcompare test plots the lines horizontaly while the model names on verticle axis. How can I plot the lines vertically and model names on horizontal axis similar to the give figure. Morever, how can I show the results of two(or more) multicopmare tests in one figure (considerint the results as group data).
Any simple example could be used e.g.,
load carsmall % load data
[p,t,stats1] = anova1(MPG,Origin,'off'); %test 1 for group 1
[c,m,h,nms] = multcompare(stats1); %multicompare 1 for group 1
[p,t,stats2] = anova1(MPG+4,Origin,'off'); %test 2 for group 2
[c,m,h,nms] = multcompare(stats2); %multicompare 2 for group 2
However, I need the output similar to the attached figure

回答(1 个)

Aditya
Aditya 2023-2-27
Hi,
I understand that you want to have the figure rotated.
You can do that programatically using the camroll function.
load carsmall % load data
[p,t,stats1] = anova1(MPG,Origin,'off'); %test 1 for group 1
[c,m,h,nms] = multcompare(stats1); %multicompare 1 for group 1
[p,t,stats2] = anova1(MPG+4,Origin,'off'); %test 2 for group 2
[c,m,h,nms] = multcompare(stats2); %multicompare 2 for group 2
camroll(90)
You can use Rotate 3D Tool of figure for changing orientation in general
For plotting together, there are many strategies. You can try using subplot
load carsmall % load data
[p,t,stats1] = anova1(MPG,Origin,'off'); %test 1 for group 1
camroll(90)
subplot(1,2,1)
[c,m,h,nms] = multcompare(stats1); %multicompare 1 for group 1
[p,t,stats2] = anova1(MPG+4,Origin,'off'); %test 2 for group 2
subplot(1,2,2)
[c,m,h,nms] = multcompare(stats2); %multicompare 2 for group 2
  1 个评论
Abdulllah
Abdulllah 2023-2-27
编辑:Abdulllah 2023-2-27
For this type of graph, 3D creates just mess. It shifts the axis, mixup the text etc. I am looking for a proper solution e.g., similar to group bar charts or group box plots. I wonder why it does not have verticle direction. I am happy the staff has responded me. Is it possible for you to please find some proper solution, since the subplot is also not doing the job similar to what I need (as show in attached figure). Thank you.
p.s. My data is actually different. for each group. If I use the subplot, all the axis are different. I need to use single axis. I can re-set the axis but I have to do many plots so this solution is not convinient.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Spectral Estimation 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by