Why does a BAR subplot change when I create another BAR subplot on the same figure, in MATLAB 8.0 (R2012b)?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 25 Okt. 2013
Beantwortet: MathWorks Support Team
am 25 Okt. 2013
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?
Akzeptierte Antwort
MathWorks Support Team
am 25 Okt. 2013
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!