MATLAB Answers

How to change the marker symbol on the plots generated by anovan function?

4 views (last 30 days)
For example:
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])
Would give me a plot like this:
ThreeWayANOVAMultipleComparisonsExample_02.png
How would I change those circle markers to dots?

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 26 Jan 2020
The third output of multcompare is the figure handle of the figure it drew into. Assuming that you call that fig
ch = fig.Children(1).Children(); %children of the axes
marker_handles = ch(2:2:end);
Now you can
set(marker_handles, 'Marker', '.')
Unfortunately the dots will be nearly invisible unless you increase the marker size -- and if you do that, then you are essentially just doing a filled circle marker and instead of changing marker shape you should consider something similar to
set(marker_handles, {'MarkerFaceColor'}, get(marker_handles, 'Color'))

  5 Comments

Show 2 older comments
Zeynab Mousavikhamene
Zeynab Mousavikhamene on 3 Jun 2020
is it possible to color each row of the above plot with a specific color like color coding?
Walter Roberson
Walter Roberson on 3 Jun 2020
To change the marker size:
set(marker_handles, {'MarkerSize'}, num2cell(Vector_Of_New_Sizes))
Vector_Of_New_Sizes must have the same length as the number of marker handles.
Note: in the special case where you are setting them all to the same size then
set(marker_handles, 'MarkerSize', New_Size)

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by