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

11 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Haris K.
Haris K. le 11 Mar 2021
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';

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by