I have the following code to compare two sets of box plots and there seems to be two misaligned x-axis labels after doing that! I have no idea what is causing this strange misalignment. Could the use of 'hold' be a problem in this case? Im using matlab 2014. Thanks.
x = rand(5,1);y = rand(10,1);z = rand(15,1);Xpos = [2 5 12];group = [repmat(Xpos(1), 5, 1); repmat(Xpos(2), 10, 1); repmat(Xpos(3), 15, 1)];data=[x;y;z];figureboxplot(data, group,'positions', Xpos,'colors','k')hold onx =2+ rand(5,1);y = 2+rand(10,1);z = 2+rand(15,1);group = [repmat(Xpos(1), 5, 1); repmat(Xpos(2), 10, 1); repmat(Xpos(3), 15, 1)];data=[x;y;z];boxplot(data, group,'positions', Xpos,'colors','r')ylim([0 4])
Best Answer