How do I get rid of the dotted lines when using multcompare?
4 次查看(过去 30 天)
显示 更早的评论
I want to use a figure from multcompare in a paper, I want to get rid of the vertical dotted lines that show the interval of convergence.
y = [52.7 57.5 45.9 44.5 53.0 57.0 45.9 44.0]';
g1 = [1 2 1 2 1 2 1 2];
g2 = {'hi';'hi';'lo';'lo';'hi';'hi';'lo';'lo'};
g3 = {'may';'may';'may';'may';'june';'june';'june';'june'};
[~,~,stats] = anovan(y,{g1 g2 g3},'model','interaction',...
'varnames',{'g1','g2','g3'});
results = multcompare(stats,'Dimension',[1 2])
0 个评论
采纳的回答
Adam Danz
2019-9-9
[results,~,h] = multcompare(stats,'Dimension',[1 2]); %return 'h', the figure handle
axh = gca(h); % get the axis handle
axh.XLimMode = 'Manual'; % if you don't do this, the xlim will change when lines are removed
axh.YLimMode = 'Manual'; % if you don't do this, the ylim will change when lines are removed
refLineHandles = findobj(axh.Children,'LineStyle', ':'); % find the handle to the ':' lines
delete(refLineHandles) % delete those lines
4 个评论
Michael Werthmann
2021-7-5
Hello Adam,
I have a different question. I actually want to plot all the vertical dotted lines for all groups and not just the one I clicked on. Is that possible. Can I then change the colours to the same colour for all?
Kind Regards
Michael
Adam Danz
2021-7-6
You can use xline(__,'k:','Alpha',.2) to add vertical lines. You just need to determine the x-value for the line.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!