How do I get rid of the dotted lines when using multcompare?

1 Ansicht (letzte 30 Tage)
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])

Akzeptierte Antwort

Adam Danz
Adam Danz am 9 Sep. 2019
[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 Kommentare
Michael Werthmann
Michael Werthmann am 5 Jul. 2021
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 am 6 Jul. 2021
You can use xline(__,'k:','Alpha',.2) to add vertical lines. You just need to determine the x-value for the line.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by