# How to set the whole values in the "y" axis?

23 views (last 30 days)
Tony Castillo on 14 Jan 2019
Commented: OCDER on 15 Jan 2019
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?.
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)');

OCDER on 14 Jan 2019
ax = gca;
ax.YRuler.Exponent = 0;
%%%%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 !!!

Tony Castillo on 14 Jan 2019
Thanks for your help, I will do it.
Tony Castillo on 15 Jan 2019
Do you know how to add a value in the top of each column?, because I want adding the respective percentage in the bar graph.
OCDER on 15 Jan 2019