Extracting from boxchart function the median, quartiles, and whisker data.
Show older comments
Hello dear community. I've got mutliple comparisons that I have plotted with boxchart. When I hover the cursor over any boxoplot, I can see the median, quartile, and whisker info. But I'm having difficulty extracting from the boxchart properities the numerical values. My goal is to the save directly these data value that boxchart clearly produce into an array.
Here's some mock code for three boxplots :
y1 = rand(10,1);
y2 = rand(8,1);
y3 =rand(12,1);
X = [ones(length(y1),1); 2*ones(length(y2),1); 3*ones(length(y3),1)]; % boxchart positions for raw data
Y = [y1; y2; y3]; % raw data values
b = boxchart(X,Y);
If I where to type "b.DataTipTemplate.DataTipRows.Value" I can see the variables Whiskers and Medians and others but cannot access them with dot notation. How would I get the values for say the second box plot?
b.DataTipTemplate.DataTipRows.Value
Thanks in advance.
Accepted Answer
More Answers (2)
the cyclist
on 30 May 2023
1 vote
As you may know, but just in case you do not, there is also the boxplot function, which has more flexibility than boxchart.
hxen
on 30 May 2023
0 votes
Categories
Find more on Box Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!