how to title of subplot

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

 Accepted Answer

Jonas
Jonas on 29 May 2021

0 votes

call title() after plotting (after bar() ), that should work the normal way

More Answers (0)

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Asked:

on 29 May 2021

Answered:

on 29 May 2021

Community Treasure Hunt

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

Start Hunting!