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

63 visualizzazioni (ultimi 30 giorni)
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)');

Risposta accettata

OCDER
OCDER il 14 Gen 2019
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 !!!
  3 Commenti
Tony Castillo
Tony Castillo il 15 Gen 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su View and Analyze Simulation Results in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by