function mapdrawYawsEndemic %This file draws a map of the World, coloring countries based on their %current status of Yaws endemicity. %-------- %Last Modified: 12.21.2021 %Written on Matlab R2021a Update 2 (9.10.0.1669831) %with Mapping Toolbox %This file requires the borders.m package from %(https://www.mathworks.com/matlabcentral/fileexchange/50390-borders) %Data Sources: %GHOendemicity.csv from https://www.who.int/data/gho/data/indicators/indicator-details/GHO/status-of-yaws-endemicity %CSV file contain a a table of the current status of Yaws endemicity by country %Options for current status include: %No previous history of yaws %Previously endemic (current status unknown) %Currently endemic %Interrupted transmission %Data reported from 2018 %ssd_admbnda_adm0_imwg_nbs_20180817.shp from https://data.humdata.org/dataset/south-sudan-administrative-boundaries %Shapefile of South Sudan %sdn_admbnda_adm0_cbs_nic_ssa_20200831.shp from https://data.humdata.org/dataset/sudan-administrative-boundaries-levels-0-2 %Shapefile of Sudan %Shapefiles of South Sudan and Sudan are used because the borders %package does not recognize them as two separate countries, however the %data from the WHO lists the two countries seperately, therefore the %must be plotted seperately. %The borders package lists some countries names differently than %reported by the WHO, some examples are: %Myanmar (WHO) = Burma (borders) %Eswatini (WHO) = Swaziland (borders) %Republic of Korea (WHO) = Korea, Republic of (borders) %United States of America (WHO) = United States (borders) %Cleaning of the CSV file to reflect the names recognized by the %borders package was done prior to reading the data into MATLAB. tic %timing function to test efficiency % Set the file for textual output and write the date and time we run the code % After multiple run, the last output is at the bottom of this text file diary 'mapdrawYaws_code_output.txt' disp_Diary('--------------- New run ----------------') disp_Diary(datetime) %% Step 1: File Uploads and Data Cleaning %Import the options of the csv file opts=detectImportOptions('GHOendemicity.csv'); %Defines what row variable names are found in opts.VariableNamesLine = 2; %Defines line that the data begins on opts.DataLine = 3; %Reads the table YawsEndemicCountryData = readtable('GHOendemicity.csv',opts, 'ReadVariableNames', true); %Loads the list of places that are recognized by the borders %package bd = load('borderdata.mat'); %Gives a list of all of the countries that reported data CountryNames = YawsEndemicCountryData(:,1); %% Step 2: Use borders.m package to draw the map % Start a new figure figure %prints all of the country borders, with grey fill bordersm('countries','black','facecolor', [0.5,0.5,0.5]) framem('off'); %Remove Frame mlabel off; % Get the numbers off (latitute) plabel off; % Get the numbers off (longitute) %goes through each country in the data and colors based on yaws status for countryIndex = 1:size(CountryNames,1) disp_Diary(CountryNames{countryIndex,1}); disp_Diary(YawsEndemicCountryData{countryIndex,2}); %This line ensures that only countries that are %recognized by the borders package are filled in %Specifically excludes South Sudan and Sudan if contains(YawsEndemicCountryData{countryIndex,1}, bd.places) && not(strcmp(YawsEndemicCountryData{countryIndex,1},'South Sudan')) && not(strcmp(YawsEndemicCountryData{countryIndex,1},'Sudan')) %Defines a color for each country based on yaws status, %default color is white. Color = [1,1,1]; if strcmp('No previous history of yaws',YawsEndemicCountryData{countryIndex,2}) Color = [1,1,1]; %No history is White elseif strcmp('Previously endemic (current status unknown)',YawsEndemicCountryData{countryIndex,2}) Color = [0.678, 0.847, 0.902]; %Previously is Light Blue elseif strcmp('Currently endemic',YawsEndemicCountryData{countryIndex,2}) Color = [1, 0, 0]; %Currently is Red elseif strcmp('Interrupted transmission',YawsEndemicCountryData{countryIndex,2}) Color = [0, 0, 1]; %Transmission interupted is Green else disp_Diary(CountryNames{countryIndex,1}); end %fills in the given country with color described above. bordersm(CountryNames{countryIndex,1}, 'facecolor', Color) elseif not(strcmp(YawsEndemicCountryData{countryIndex,1},'South Sudan')) && not(strcmp(YawsEndemicCountryData{countryIndex,1},'Sudan')) disp(CountryNames{countryIndex,1}); end end %Defines legend based on specified example colors h(5) = bordersm('Western Sahara', 'facecolor', [0.5,0.5,0.5]); h(1) = geoshow('sdn_admbnda_adm0_cbs_nic_ssa_20200831.shp', 'FaceColor', [1,1,1],'LineWidth',0.5);%Sudan h(2) = geoshow('ssd_admbnda_adm0_imwg_nbs_20180817.shp', 'FaceColor', [0.678, 0.847, 0.902],'LineWidth',0.5);%South Sudan h(4) = bordersm('India', 'facecolor', [0, 0, 1]); h(3) = bordersm('Ghana', 'facecolor', [1, 0, 0]); lgd = legend([h(1),h(2),h(3),h(4),h(5)],'No History','Previously Endemic, Currently Unknown','Currently Endemic', 'Interrupted Transmission', 'No data'); lgd.NumColumns = 2 lgd.Location = 'SouthOutside' % Save the figure SaveFigure('YawsMap') toc %% Additional Functions function SaveFigure(filename) % Saves a current graphics file to file named filename.pdf % Get the handle h=gcf; set(h,'Units','Inches'); pos = get(h,'Position'); % Cut all the white margins set(h,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)]) % Actually save print(h,['Figures/' filename, '.pdf'],'-dpdf','-r0') % This outputs on the screen what figure was saved into what file disp_Diary(['Saved a figure ' num2str(get(gcf,'Number')) ' into a file ' ... filename '.pdf']) end function disp_Diary(string) % Displays text on the screen and also logs it in the diary diary on disp(string) diary off end end