필터 지우기
필터 지우기

can we set beside each one bar graph another comparative?

조회 수: 1 (최근 30일)
Tony Castillo
Tony Castillo 2017년 3월 28일
댓글: KSSV 2017년 3월 28일
Hi dear mathfriends, i need some help in order to set one bar graph, next to another one for make possible the comparisson between generation and comsumption, can you check it my code and give me some help to improve the attached graph? This is the code:
% % Salidas de datos mes={'Ene' 'Feb' 'Mar' 'Abr' 'May' 'Jun' 'Jul' 'Ago' 'Sep' 'Oct' 'Nov' 'Dic'};
%SALIDAS GRAFICAS
figure(1)
grid on
hold on
% title('Maximum Photovoltaic Power Harvesting');
xlabel('Meses [2015]');
ylabel('Energía [W·h]');
xlim([1 365]);
ax = gca;
ax.XTick = [1:30.4:365];
set(gca,'XTickLabel',mes);
ylim([0 Inf]);
% legend('Potencia Generable', 'Consumo');
% Y=[Pmax, CMUD1];
bar (Pmax, 'green');
hold on
bar (CMUD1, 'white');
% bar(Y);

채택된 답변

KSSV
KSSV 2017년 3월 28일
d1 = rand(5,1) ;
d2 = rand(5,1) ;
y = zeros(2*5,1) ;
y(1:2:end) = d1 ;
y(2:2:end) = d2 ;
figure
hold on
for i = 1:numel(y)
if mod(i,2)==0
bar(i, y(i),'facecolor', 'r');
else
bar(i, y(i),'facecolor', 'b');
end
end
  댓글 수: 2
Tony Castillo
Tony Castillo 2017년 3월 28일
Hi, thanks for your fast answer, but i have a doubt now if my variables to graph are Pmax and CMUD1, in the code above, wich is each one?, i mean for substitute, and graph with my values.
KSSV
KSSV 2017년 3월 28일
Take data1 as Pmax and data2 as CMUD1.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by