Filter löschen
Filter löschen

An easy way to add the mean to boxplotGroup of Adam Danz?

13 Ansichten (letzte 30 Tage)
Sim am 8 Dez. 2023
Kommentiert: Voss am 14 Jun. 2024 um 20:00
Is there an easy and straightforward way to add the mean to the boxplotGroup of @Adam Danz?

Akzeptierte Antwort

Voss am 8 Dez. 2023
x = {rand(100,4), rand(20,4)*.8, rand(1000,4)+.2};
means = cellfun(@(x)mean(x,1),x,'UniformOutput',false);
h = boxplotGroup(x);
NG = numel(h.boxplotGroup);
for ii = 1:NG
N = size(x{ii},2);
xdata = get(h.boxplotGroup(NG-ii+1).Children(N:-1:1),{'XData'});
for jj = 1:N
line(xdata{jj},means{ii}(jj)*[1 1], ...
  4 Kommentare
Adam Danz
Adam Danz am 14 Jun. 2024 um 17:46
For some reason I just saw this question today, about 6 months late.
Great answer, Voss!
Voss am 14 Jun. 2024 um 20:00
Thanks Adam!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)


Mehr zu Data Import and Analysis 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!

Translated by