Clear Filters
Clear Filters

How do i compile the multiple Graphs in my code to show all the graphs and pie charts at once

2 views (last 30 days)
% for loop for fires/notfires
result1 = strings(1,length(isi1));
result = strings(1,length(isi1));
for i = 1:length(isi1)
if (isi1(i) >= 2.8) && (bui1(i) >= 5.1) && (fwi1(i) >=1.7)
result(i) = "fire";
result1(i) = 1;
else
result(i) = "no fire";
result1(i) = 0;
end
end
% converting classes column to binary
claresult = strings(1,length(cla1));
for i = 1:length(cla1)
if cla1(i) == "fire"
claresult(i) = 1;
elseif cla1(i) == "not fire"
claresult(i) = 0;
end
end
%inconsistencies
j = strcmp(result1,claresult);
numofinconsistancies = numel(j) - nnz(j);
% Pie chart for fire/not fires
f = sum(count(claresult,"1"));
nf = sum(count(claresult,"0"));
vfnf = [f,nf];
labels = {'Fires','No Fires'};
pie(vfnf,labels)
title('Fires in Bejaia Region')
% Analyzing Fires/No fires for Sidi-Bel Reigon and making pie chart
% for loop for fires/notfires
result2 = strings(1,length(isi2));
result3 = strings(1,length(isi2));
for i = 1:length(isi2)
if (isi2(i)>=2.7) && (bui2(i)>=6) && (fwi2(i)>=2.5)
result2(i) = "fire";
result3(i) = 1;
else
result2(i) = "not fire";
result3(i) = 0;
end
end
%Converting classes column to binary
claresult1 = strings(1,length(cla2));
for i = 1:length(cla2)
if cla2(i) == "fire"
claresult1(i) = 1;
elseif cla2(i) == "not fire"
claresult1(i) = 0;
end
end
%Inconsistencies
j1 = strcmp(result3,claresult1);
numofinconsistencies = numel(j1)-nnz(j1);
% Pie chart for fire/not fires
f1 = sum(count(claresult1,"1"));
nf1 = sum(count(claresult1,"0"));
vfnf1 = [f1,nf1];
labels = {'Fires','No Fires'};
pie(vfnf1,labels)
title('Fires in Sidi-Bel Region')

Answers (1)

Adit Kirtani
Adit Kirtani on 21 Feb 2023
Hi Abdul,
You can utilize either subplots or tiledlayouts for your purpose, based on your preference.
I hope this helps,
Adit Kirtani.

Categories

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

Community Treasure Hunt

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

Start Hunting!