""" Plot detailed figures for each country """ import matplotlib.pyplot as pp from mpl_toolkits.axisartist.parasite_axes import HostAxes, ParasiteAxes import numpy as np import time as time_module import pickle import logging logging.getLogger().setLevel(logging.CRITICAL) import os def plot(data, countries, pop, metadata, **kwargs): figsize = (10,5) for loc in data: if loc == "International": continue if loc == "World": continue path = "img/"+f"{loc}".replace(" ", "_").replace("'", "").replace("/", "") if not os.path.isdir(path): os.mkdir(path) if not os.path.isfile(path+"/index.html") or True: # TODO enable html file generation with open(path+"/index.html", "w") as f: f.write(f"""
| ISO Code | {metadata[loc]["iso_code"]} |
| Continent | {metadata[loc]["continent"]} |
| Country name | {metadata[loc]["location"]} |
| Population | {metadata[loc]["population"]} |
| Population density | {metadata[loc]["population_density"]} |
| Median age | {metadata[loc]["median_age"]} |
| % older than 65 | {metadata[loc]["aged_65_older"]} |
| % older than 70 | {metadata[loc]["aged_70_older"]} |
| GDP per capita | {metadata[loc]["gdp_per_capita"]} |
| Extreme poverty | {metadata[loc]["extreme_poverty"]} |
| Cardiovascular death rate | {metadata[loc]["cardiovasc_death_rate"]} |
| Diabetes prevalence | {metadata[loc]["diabetes_prevalence"]} |
| female smokers (%) | {metadata[loc]["female_smokers"]} |
| male smokers (%) | {metadata[loc]["male_smokers"]} |
| Handwashing facilities | {metadata[loc]["handwashing_facilities"]} |
| hospital beds per thousand inhabitants | {metadata[loc]["hospital_beds_per_thousand"]} |
| life expectancy | {metadata[loc]["life_expectancy"]} |
| human development index | {metadata[loc]["human_development_index"]} |

