problem with x-axis labels after overlapping 2 box plots
古いコメントを表示
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];
figure
boxplot(data, group,'positions', Xpos,'colors','k')
hold on
x =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])

4 件のコメント
dpb
2014 年 5 月 30 日
Looks as expected on R2012b--no duplicate x-labels.
What's the 'renderer' setting for your case, just out of curiosity.
Is this reproducible on your system, I suppose? If so, I'd say it deserves a bug report to TMW at mathworks.com
Chad Greene
2014 年 5 月 30 日
I'm also using 2012b and it looks fine for me too. I cycled through all the renderers and I can't repeat Dawn's duplicate labels.
Star Strider
2014 年 5 月 30 日
I can’t reproduce it in R2014a. Looks fine — no duplicated or repeated x values.
To wit:

Although it doesn’t match Dawn’s plot. There may be something strange in Dawn’s workspace (workspace variables?) or in her code that we are not privy to.
The real Question is what Dawn did to get MATLAB mad at her?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

