0
您好我有在Matlab情节MATLAB堆积条形图,显示所有的值
CC_monthly_thermal_demand = [495 500 500 195 210 100 70 65 85 265 320 430]';
AD_monthly_thermal_generation_250 = [193 193 193 193 193 193 193 193 193 193 193 193]';
figure;
bar(1:12,AD_monthly_thermal_generation_250)
hold on
bar(1:12,CC_monthly_thermal_demand,'r')
set(gca,'XTickLabel',{'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',' Sep', 'Oct', 'Nov',' Dec'},'FontSize',18)
title('Seasonal Anaerobic Digestion (250kWe) Thermal Energy Supply to Demand - 2012','FontSize',22)
ylabel('Thermal Energy (MWhe)')
legend('250 kWth Supply','Thermal Energy Demand')
grid on
axis([0 13 0 600])
下面的代码我试图绘制一个堆积条形图,显示了每一个栏每个变量的颜色。但是,对于“AD_monthly_thermal_generation_250”值低于“CC_monthly_thermal_demand”值的条形图,“AD_monthly_thermal_generation_250”色彩由“CC_monthly_thermal_demand”完全覆盖,因此我看不到这些值。它能够看到它们吗?
谢谢
是p可以这样做,以便条形图的y值与“A”和“B”中的数字相对应。我认为你的建议确实显示了每个栏的两个值,但这些值并不代表“A”和“B”中的值。它的作用是在“B”之后开始计算“A”,所以你得到了条形顶部= A + B – user643469 2013-04-27 13:28:25
感谢你的建议 - 看起来相当不错。请让我知道,如果我问的是不可能的(在一个图表上有条)。 – user643469 2013-04-27 13:45:35
你的意思是把酒吧**分组**吗?像在酒吧([A,B])? – Oleg 2013-04-27 13:46:30