how to title of subplot

2 visualizaciones (últimos 30 días)
Muhammad
Muhammad el 29 de Mayo de 2021
Respondida: Jonas el 29 de Mayo de 2021
function untitled(country1,state1,country2,state2,names,days,avg_days,dailycases)
if isempty(state1) && isempty(state2)
Index1 = strcmpi(names,country1);
dailydata1= dailycases(Index1,:);
daily_cases1 = movmean(dailydata1, avg_days);
daily__cases1=daily_cases1(1,:)
figure
subplot(2,1,1)
title('19-ee-65')
bar(days(1:end-1),daily__cases1);
Index2 = strcmpi(names,country2);
dailydata2= dailycases(Index2,:);
daily_cases2 = movmean(dailydata2, avg_days);
daily__cases2=daily_cases2(1,:)
subplot(2,1,2)
title('19-ee-66')
bar(days(1:end-1),daily__cases2);
else
Index1 = strcmpi(names(:,2),state1);
dailydata1= dailycases(Index1,:);
daily_cases1 = movmean(dailydata1, avg_days);
daily__cases1=daily_cases1(1,:)
figure
subplot(2,1,1)
title(state1)
bar(days(1:end-1),daily__cases1);
Index2 = strcmpi(names(:,2),state2);
dailydata2= dailycases(Index2,:);
daily_cases2 = movmean(dailydata2, avg_days);
daily__cases2=daily_cases2(1,:)
subplot(2,1,2)
title(state2)
bar(days(1:end-1),daily__cases2);
end
i want to give title '19-ee-65' to graph one and title '19-ee-66' to graph two how i can in IF statement

Respuesta aceptada

Jonas
Jonas el 29 de Mayo de 2021
call title() after plotting (after bar() ), that should work the normal way

Más respuestas (0)

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by