0
嗨我正在嘗試在matlab中創建堆積條形圖,但輸出圖似乎將第一個數據集(AD_monthly_generation_250)添加到第二個(CC_monthly_demand_2012)。我怎樣才能避免這種情況?在matlab中創建堆積條形圖
我的代碼是
%% AD STACKED CC %%
AD_monthly_generation_250 = [186 186 186 186 186 186 186 186 186 186 186 186]';
CC_monthly_demand_2012 = [199.575 206.701 145.284 135.944 127.689 93.281 80.311 78.859 98.145 168.572 206.365 113.030]';
% Create a stacked bar chart using the bar function
figure;
bar(1:12, [ AD_monthly_generation_250 CC_monthly_demand_2012 ], 0.5, 'stack');
% Add title and axis labels
title('Seasonal Anaerobic Digestion (250kWe) Supply to Demand - 2012','FontSize',22);
set(gca,'XTickLabel',{'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',' Sep', 'Oct', 'Nov',' Dec'},'FontSize',18)
ylabel('Energy (MWh)');
感謝,但似乎並不上班。我所得到的是一個條形圖,其y軸值與AD_monthly_generation_250相同 – user643469
@ user643469:我錯誤地評論了其中一行。我更新了上述答案中的代碼。你能再試一次嗎? – 2013-04-13 19:18:07
完美,謝謝 – user643469