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])

采纳的回答

Adam Danz
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
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
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 CenterFile 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!

Translated by