How to set the whole values in the "y" axis?
조회 수: 58 (최근 30일)
이전 댓글 표시
Hi dear MATLAB community,.
I want to ask you how to portray in the Y axis the whole number (quantity), not as appear in my code, which is based on engineering format, do you know how to do it?.
Thanks in advance
clear all
close all
%%%%Price in every part of the components of the facility
Panels=230000;
Batteries=123000;
MPP=15000;
Maintenance=116000;
OtherExpenses=73000;
Transformer=4000;
c = categorical({'Panels','Batteries','MPP','Maintenance','OtherExpenses'});
X = [Panels,Batteries,MPP,Maintenance,OtherExpenses];
%%%subplot one
ax1 = subplot(1,2,1);
p1=bar(ax1,c,X);
title(ax1,'PV facility cost (models B&C)');
%%%%subplot two
c1 = categorical({'Batteries','Transformer','Maintenance','OtherExpenses'});
Y = [Batteries,Transformer,Maintenance,OtherExpenses];
ax2 = subplot(1,2,2);
p2=bar(ax2,c1,Y);
title(ax2,'Fossil facility cost (model A)');
댓글 수: 0
채택된 답변
OCDER
2019년 1월 14일
See post about adjusting the axes YRuler and XRuler properties.
ax = gca;
ax.YRuler.Exponent = 0;
Your code:
%%%%Price in every part of the components of the facility
Panels=230000;
Batteries=123000;
MPP=15000;
Maintenance=116000;
OtherExpenses=73000;
Transformer=4000;
c = categorical({'Panels','Batteries','MPP','Maintenance','OtherExpenses'});
X = [Panels,Batteries,MPP,Maintenance,OtherExpenses];
%%%subplot one
ax1 = subplot(1,2,1);
p1=bar(ax1,c,X);
title(ax1,'PV facility cost (models B&C)');
ax1.YRuler.Exponent = 0; %ADD THIS !!!
%%%%subplot two
c1 = categorical({'Batteries','Transformer','Maintenance','OtherExpenses'});
Y = [Batteries,Transformer,Maintenance,OtherExpenses];
ax2 = subplot(1,2,2);
p2=bar(ax2,c1,Y);
title(ax2,'Fossil facility cost (model A)');
ax2.YRuler.Exponent = 0; %ADD THIS !!!
추가 답변 (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!