How to select the desired color of the point in stat_summa​ry('geom',​{'point'}) in the Gramm Toolbox?

조회 수: 15 (최근 30일)
Hi. I am making a violin plot with a box plot inside, using the Gramm toolbox. I would like to also show the mean, but I do not know how to color it (say red or black).
To plot the mean, I am using the method g.stat_summary('geom',{'point'}). It seems like it produces the desired line, but it has the same color as the rest of the graph. I was wondering if anyone knows how to change that so that to make it clearly visible.
Here's some data:
load carbig.mat
cars.Cylinders = Cylinders;
cars.Origin_Region = cellstr(Origin);
cars.Horsepower = Horsepower;
Here's the code I am using for the graph:
g=gramm('x',cars.Origin_Region,'y',cars.Horsepower);
g.set_names('x','Origin','y','Horsepower');
g.stat_violin('normalization','width','fill','transparent','width',0.8,'half',false);
g.stat_boxplot('width',0.15);
g.set_title('Violin Plot');
g.stat_summary('geom',{'point'}); %<- adds the MEAN to the graph
g.set_color_options('map', [0.1922, 0.5098, 0.7412]);
g.coord_flip();
figure;
g.draw();
Here's the official Toolbox page:
Thanks

채택된 답변

Haris K.
Haris K. 2021년 3월 11일
With a little bit of searching through the created structure, I have found one solution.
g.results.stat_summary.point_handle.MarkerEdgeColor='red';
g.results.stat_summary.point_handle.Marker='x';

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by