Adding dots to a box-plot

14 visualizaciones (últimos 30 días)
Rotem Ben-Hamo
Rotem Ben-Hamo el 22 de Nov. de 2017
Respondida: Akira Agata el 27 de Nov. de 2017
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!

Respuestas (1)

Akira Agata
Akira Agata el 27 de Nov. de 2017
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)

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by