Adding dots to a box-plot

11 ビュー (過去 30 日間)
Rotem Ben-Hamo
Rotem Ben-Hamo 2017 年 11 月 22 日
回答済み: Akira Agata 2017 年 11 月 27 日
Hello I have a figure with 8 boxplots and I would like to add the actual data to the figure by adding dots.
Since there isn't a straight foreword way of doing so I am trying to add the dots one by one to the figure. Unfortunately, I cant seem to figure it out. this is what I am doing:
boxplot(A,B); % A is a numerical vector and B is Char array.
hold on
scatter(0.3,1)
But the dot does not appear.
Can anyone help out with this?
Thanks so much!

回答 (1 件)

Akira Agata
Akira Agata 2017 年 11 月 27 日
Since the XTick of the 1st, 2nd... box plots are 1, 2..., x = 0.3 might be too small to display on the graph. If you adjust (x,y) value of the dot properly, you can add the dot on the plot, like:
x = rand(1000,1);
group = mat2cell('a':'h',1,ones(8,1));
g = group(randi([1,8],1000,1));
boxplot(x,g)
hold on
scatter(1.5, 0.5)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by