specify limits in boxplot-style plot

3 visualizzazioni (ultimi 30 giorni)
Daniel Madigan
Daniel Madigan il 31 Gen 2022
Risposto: Animesh Gupta il 3 Feb 2022
Hi all,
I am looking to make a plot in the traditional boxplot visual style; however, the plot will use credible intervals from an externally run Bayesian mixing models, rather than having it calculated from input data.
So, I am looking for a way to plot a boxplot-style figure, in which I am able to manually input the values for the mean, box edges, and box whiskers, rather than have the function itself calculate any of these values.
Any help is much appreciated, thank you.

Risposte (1)

Animesh Gupta
Animesh Gupta il 3 Feb 2022
Hello Daniel,
It is my understanding that you are trying to manually enter the values for mean, box edges and box whiskers for boxplot function. Currently, “boxplot” function does not support the feature for plotting the mean or changing the default quartiles for box edges. But you can change the box whiskers. You may refer the boxplot function to know more about it.
You may also refer the below mentioned workaround to visualize mean of the data.
% initialising data
rng('default')
x1 = rand(5,1);
x2 = rand(10,1);
x3 = rand(15,1);
x = [x1; x2; x3];
g1 = repmat({'First'},5,1);
g2 = repmat({'Second'},10,1);
g3 = repmat({'Third'},15,1);
g = [g1; g2; g3];
% boxplot with median
boxplot(x,g)
hold on
medTags = findall(gcf,'Tag','Median');
set(medTags,'Visible','off');
% boxplot with mean but wihout median
plot(fliplr(vertcat(medTags.XData)'),repmat(mean(x),2,1),'red');
I hope it helps.

Community Treasure Hunt

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

Start Hunting!

Translated by