How to align the x axis of bar graphs in R2018b
조회 수: 11 (최근 30일)
이전 댓글 표시
The bar plots in the Matlab version 2018 doesnot align with the x - axis labels as was in the previous version. How can this be corrected? Attached plots from both versions for reference.
Version 2017:
Version R2018b:
댓글 수: 3
채택된 답변
Cris LaPierre
2018년 12월 18일
I can't explain why behavior has changed, but I see what is happening. The xlim of your plots is different.
- xlim - T/C rpm: [ 0.5571 6.4429]
- xlim - Scavange pressure: [-0.0500 7.0500]
There are two ways around it that I've tested.
- Set xlim to be the same in both plots: xlim([0,7])
- include the months as the X variable when you call the bar function.
m = categorical({'Apr','May','Jun','Aug','Oct','Nov'});
Compare_months = reordercats(m,{'Apr','May','Jun','Aug','Oct','Nov'});
...
subplot(211);
bar(Compare_months,Turbocharger_rpm_dev_trend','barwidth', 0.5);
ylabel('%','FontSize',10)
title('T/C rpm deviation from nominal')
legend('T/C # 1','T/C # 2','Orientation','horizontal')
grid on
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!