Cannot plot additional scatter points in a boxplot
Show older comments
Hello all,
I've got 15 horizontaly orientated boxplots in the same graph with 15 column vectors (x1, x2... x15) each with a different length.
I want to draw two scatter points at y=2 (the points are (x=0.4, y=2.0) and (x=0.6, y=2.0) above the last boxplot which is located at y=1.6.
However I cannot plot those two points and I do know that the command 'hold on' restricts the limits of the boxplots.
*********************************************************************
My code unitl now looks like:
Ypos = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.5 1.6];
-----------
group_fordata = [repmat(Ypos(1),[size(x1),1]); repmat(Ypos(2),[size(x2)],1); repmat(Ypos(3),[size(x3)],1); repmat(Ypos(4),[size(x4)],1); repmat(Ypos(5),[size(x5)],1); repmat(Ypos(6),[size(x6)],1); repmat(Ypos(7),[size(x7)],1); repmat(Ypos(8),[size(x8)],1); repmat(Ypos(9),[size(x9)],1); repmat(Ypos(10),[size(x10)],1); repmat(Ypos(11),[size(x11)],1); repmat(Ypos(12),[size(x12)],1); repmat(Ypos(13),[size(x13)],1); repmat(Ypos(14),[size(x14)],1); repmat(Ypos(15),[size(x15)],1)];
-------------
data = [x1;x2;x3;x4;x5;x6;x7;x8;x9;x1;x11;x12;x13;x14;x15]
----------
figure
boxplot(data, group_fordata,'positions', Ypos,'orientation','horizontal')
hold on
plot([0.4 0.6],[2.0 2.0],'g.')
*************************************************************
I cannot see the two points in green plotted. Any alternative to 'hold on' that would allow me to plot something above the value 1.6 of the y-axis?
Many thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!