Plot boxplot giving it the median, range and quartiles

3 ビュー (過去 30 日間)
Edward
Edward 2014 年 2 月 11 日
コメント済み: Salaar Khan 2022 年 2 月 16 日
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 件のコメント
yair suari
yair suari 2015 年 11 月 2 日
Its a boxplot
Mike Garrity
Mike Garrity 2015 年 11 月 2 日
Which is part of the Statistics toolbox.

サインインしてコメントする。

回答 (2 件)

the cyclist
the cyclist 2015 年 11 月 2 日
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)

Soleil Hernandez
Soleil Hernandez 2016 年 6 月 13 日
how would this change if I was putting 3 box plots on the same figure?
  1 件のコメント
Salaar Khan
Salaar Khan 2022 年 2 月 16 日
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)

サインインしてコメントする。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by