Change x- and y-axis description in multcompare()
3 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Pratik
2024 年 9 月 3 日
Hi Annika,
I understand that the title, and the description of the of the plot need to be changed.
Following code snippet can be added after "multcompare" function to achieve the same.
% Customize the plot
xlabel('Group Comparison');
ylabel('Mean Difference');
title('Tukey HSD Test Results');
Please refer to the documentation of "xlabel", "ylabel" and "title" for more information:
I hope this helps!
0 件のコメント
その他の回答 (2 件)
Zinea
2024 年 9 月 3 日
Yes, you can customize the axis labels and the title of a plot generated by the ‘multcompare’ function in MATLAB. Although this function itself does not directly provide options to change the axis labels or title, you can modify these properties after the plot is created using MATLAB's plotting functions.
Here is a complete MATLAB code which generates a dummy dataset, performs 'anova', followed by 'multcompare' and then changes the axis descriptions and the title:
% Generate a dummy dataset
% Assume we have three groups with different sample sizes
group1 = normrnd(5, 1, 10, 1); % Group 1 data: mean = 5, std = 1, n = 10
group2 = normrnd(6, 1, 15, 1); % Group 2 data: mean = 6, std = 1, n = 15
group3 = normrnd(7, 1, 12, 1); % Group 3 data: mean = 7, std = 1, n = 12
% Combine the data into a single vector
data = [group1; group2; group3];
% Create a grouping variable
group = [repmat({'Group 1'}, length(group1), 1);
repmat({'Group 2'}, length(group2), 1);
repmat({'Group 3'}, length(group3), 1)];
% Perform one-way ANOVA
[p, tbl, stats] = anova1(data, group);
% Perform Tukey's HSD test using multcompare
[c, m, h, gnames] = multcompare(stats);
% Customize the plot
xlabel('Mean Difference'); % X-axis label
ylabel('Group Comparisons'); % Y-axis label
title('Tukey HSD Test Results'); % Title
Output of above code:
Hope this helps you move forward!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Analysis of Variance and Covariance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!