Why does a BAR subplot change when I create another BAR subplot on the same figure, in MATLAB 8.0 (R2012b)?
1 回表示 (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2013 年 10 月 25 日
回答済み: MathWorks Support Team
2013 年 10 月 25 日
I have a simple code where I create 2 subplots with BAR graphs. When I execute this :
figure
subplot(2,1,1)
bar(round(rand(5,3)*10))
subplot(2,1,2)
bar(round(rand(5,3)*10))
The bar plots are created as expected.
However, when I execute the following code (where 'exampleBars' are my values, which span a large scales):
load exampleBars
figure
subplot(2,1,1)
bar(bar1,bar2);
subplot(2,1,2)
bar(secondX,secondY);
the first bar graph changes unexpectedly. The colour disappeared and the bars are substituted by lines.
Obviously, this is related to the data I am using. What is the problem with the data in the second example?
採用された回答
MathWorks Support Team
2013 年 10 月 25 日
The root cause of this issue is that BAR has lots of listeners going on for the x-axis to make it categorical. When working at large scales as in the second example, this functionality does not work very well and there are no workarounds.
A different approach for this case, is to use the AREA plot which does not have any of these issues.
load exampleBars
figure
subplot(2,1,1)
area(bar1,bar2);
subplot(2,1,2)
area(secondX,secondY);
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!