# Plot boxplot giving it the median, range and quartiles

6 vues (au cours des 30 derniers jours)
Edward le 11 Fév 2014
Commenté : Salaar Khan le 16 Fév 2022
Hi, I need to plot similar to this:
(Multiple categories) however I have way too much data to store in memory. Is there a way I can calculate the median, range and quartiles for each category and then plot a boxplot rather than giving the function boxplot() all the data?
Or is there a "hold on" type method where I can plot each category side by side on the same figure but one after the other?
##### 2 commentairesAfficher AucuneMasquer Aucune
yair suari le 2 Nov 2015
Its a boxplot
Mike Garrity le 2 Nov 2015
Which is part of the Statistics toolbox.

Connectez-vous pour commenter.

### Réponses (2)

the cyclist le 2 Nov 2015
Here's one way:
rng default
N = 10000;
data = randn(N,1);
figure
hold on
boxplot(data,'positions',1)
clear data
data = randn(N,1);
boxplot(data,'positions',2)
label = {'data1','data2'};
xlim([0.5 2.5])
set(gca,'XTick',[1 2],'XTickLabel',label)
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Soleil Hernandez le 13 Juin 2016
how would this change if I was putting 3 box plots on the same figure?
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Salaar Khan le 16 Fév 2022
rng default
N = 10000;
data = randn(N,1);
figure
hold on
boxplot(data,'positions',1)
clear data
data = randn(N,1);
boxplot(data,'positions',2)
label = {'data1','data2'};
clear data
data = randn(N,1);
boxplot(data,'positions',3)
label = {'data1','data2','data3'};
xlim([0.5 3.5])
set(gca,'XTick',[1 2 3],'XTickLabel',label)

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Exploration and Visualization dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by