How to select the desired color of the point in stat_summary('geom',{'point'}) in the Gramm Toolbox?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Haris K.
am 10 Mär. 2021
Beantwortet: Haris K.
am 11 Mär. 2021
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
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!